sincerely
Singaporean
If you have not done so, read this full tutorial on how to use SGEXTN to build an application.
class SGXTimeStamp;
part of SGEXTN module SG_Core
timestamp storing time with precision to the nearest second
list of all including inherited members
preprocessor file inclusion directive: #include ‹SGXTimeStamp.h›
CMake target for BuildLah: SGEXTN::SG_Core
see this link for more information about BuildLah
parent class: (none)
children classes: (none)
SGXTimeStamp(int year, int month, int day, int hour, int minute, int second);
SGXTimeStamp& addDays(long long x);
SGXTimeStamp& addHours(long long x);
SGXTimeStamp& addMinutes(long long x);
SGXTimeStamp& addMonths(long long x);
SGXTimeStamp& addSeconds(long long x);
SGXTimeStamp& addYears(long long x);
[[nodiscard]] int getDay() const;
[[nodiscard]] int getDayOfWeek() const;
[[nodiscard]] int getDayOfYear() const;
[[nodiscard]] double getDaysFrom(SGXTimeStamp x) const;
[[nodiscard]] SGXString getFileName() const;
[[nodiscard]] SGXString getFileNameCorrectToSecond() const;
[[nodiscard]] SGXString getFileNameCorrectToSecondNoOffset() const;
[[nodiscard]] SGXString getFileNameCorrectToSecondNoOffsetSeparated(SGXChar separator) const;
[[nodiscard]] SGXString getFileNameCorrectToSecondSeparated(SGXChar separator) const;
[[nodiscard]] SGXString getFileNameNoOffset() const;
[[nodiscard]] SGXString getFileNameNoOffsetSeparated(SGXChar separator) const;
[[nodiscard]] SGXString getFileNameSeparated(SGXChar separator) const;
[[nodiscard]] int getHour() const;
[[nodiscard]] double getHoursFrom(SGXTimeStamp x) const;
[[nodiscard]] int getMinute() const;
[[nodiscard]] double getMinutesFrom(SGXTimeStamp x) const;
[[nodiscard]] int getMonth() const;
[[nodiscard]] double getMonthsFrom(SGXTimeStamp x) const;
[[nodiscard]] int getSecond() const;
[[nodiscard]] double getSecondsFrom(SGXTimeStamp x) const;
[[nodiscard]] SGXString getString() const;
[[nodiscard]] SGXString getStringCustomFormat(const SGXString& s) const;
[[nodiscard]] SGXString getStringNoOffset() const;
[[nodiscard]] SGXString getStringNoOffsetCustomFormat(const SGXString& s) const;
[[nodiscard]] int getTimeFromDayPart(SGXTimeStamp x) const;
[[nodiscard]] int getTimeFromHourPart(SGXTimeStamp x) const;
[[nodiscard]] int getTimeFromMinutePart(SGXTimeStamp x) const;
[[nodiscard]] int getTimeFromMonthPart(SGXTimeStamp x) const;
[[nodiscard]] int getTimeFromSecondPart(SGXTimeStamp x) const;
[[nodiscard]] int getTimeFromYearPart(SGXTimeStamp x) const;
[[nodiscard]] int getYear() const;
[[nodiscard]] int getYearNoOffset() const;
[[nodiscard]] double getYearsFrom(SGXTimeStamp x) const;
[[nodiscard]] int hash() const;
[[nodiscard]] bool isDayAfterNationalDay() const;
[[nodiscard]] bool isDayBeforeNationalDay() const;
[[nodiscard]] bool isNationalDay() const;
[[nodiscard]] bool operator!=(SGXTimeStamp x) const;
[[nodiscard]] bool operator‹(SGXTimeStamp x) const;
[[nodiscard]] bool operator‹=(SGXTimeStamp x) const;
[[nodiscard]] bool operator==(SGXTimeStamp x) const;
[[nodiscard]] bool operator›(SGXTimeStamp x) const;
[[nodiscard]] bool operator›=(SGXTimeStamp x) const;
SGXTimeStamp& subtractDays(long long x);
SGXTimeStamp& subtractHours(long long x);
SGXTimeStamp& subtractMinutes(long long x);
SGXTimeStamp& subtractMonths(long long x);
SGXTimeStamp& subtractSeconds(long long x);
SGXTimeStamp& subtractYears(long long x);
static const SGXTimeStamp zero;
[[nodiscard]] static SGXTimeStamp now();
SGXTimeStamp allows for computations concerning date and time. The time is stored correct to the nearest second. There are builtin functions for find the day of week, day of months, number of days between 2 dates etc. Time is stored using long long, so 32bit time overflowing in 2033 is not a concern. Using SGXTimeStamp for any time zone other than Singapore time zone is undefined behaviour, you must convert the time into Singapore time zone before computation.
Stores the number of seconds after SGXTimeStamp::zero that a SGXTimeStamp refers to as a long long.
Constructs a SGXTimeStamp object with the year, month, day, hour, minute, and second set to year, month, day, hour, minute, second respectively.
year should be the year on the corresponding National Day logo. For example, 2025 should be passed in as 60 because 2025 is when we celebrate SG60.
Moves this SGXTimeStamp forwards by x days and returns a reference to this SGXTimeStamp to allow operation chaining.
Moves this SGXTimeStamp forwards by x hours and returns a reference to this SGXTimeStamp to allow operation chaining.
Moves this SGXTimeStamp forwards by x minutes and returns a reference to this SGXTimeStamp to allow operation chaining.
Moves this SGXTimeStamp forwards by x months and returns a reference to this SGXTimeStamp to allow operation chaining.
Moves this SGXTimeStamp forwards by x seconds and returns a reference to this SGXTimeStamp to allow operation chaining.
Moves this SGXTimeStamp forwards by x years and returns a reference to this SGXTimeStamp to allow operation chaining.
See explanation of SGXTimeStamp::getSecond.
Returns the day of the week corresponding to this SGXTimeStamp.
Interpret the return value as following:
1 - Monday
2 - Tuesday
3 - Wednesday
4 - Thursday
5 - Friday
6 - Saturday
7 - Sunday
This corresponds to the Chinese names of the days of the week.
Returns the day of the year corresponding to this SGXTimeStamp. This is a number between 1 and 365 or 366 inclusive.
Gets the exact number of days between this SGXTimeStamp and x.
This is positive if this SGXTimeStamp is after x and negative if this SGXTimeStamp is before x.
Returns a string representation of this SGXTimeStamp optimised for naming files, correct to the nearest day.
Returns a string representation of this SGXTimeStamp optimised for naming files, correct to the nearest second.
Returns a string representation of this SGXTimeStamp optimised for naming files, correct to the nearest second, without the offset of 1965 on the year number.
Returns a string representation of this SGXTimeStamp optimised for naming files, correct to the nearest second, with numbers separated using separator, without the offset of 1965 on the year number.
The choice of separator may cause issues with the file system. Using _ (underscore) is recommended.
Returns a string representation of this SGXTimeStamp optimised for naming files, correct to the nearest second, with numbers separated using separator.
The choice of separator may cause issues with the file system. Using _ (underscore) is recommended.
Returns a string representation of this SGXTimeStamp optimised for naming files, correct to the nearest day, without the offset of 1965 on the year number.
Returns a string representation of this SGXTimeStamp optimised for naming files, correct to the nearest day, with numbers separated using separator, without the offset of 1965 on the year number.
The choice of separator may cause issues with the file system. Using _ (underscore) is recommended.
Returns a string representation of this SGXTimeStamp optimised for naming files, correct to the nearest day, with numbers separated using separator.
The choice of separator may cause issues with the file system. Using _ (underscore) is recommended.
See explanation of SGXTimeStamp::getSecond.
Gets the exact number of hours between this SGXTimeStamp and x.
This is positive if this SGXTimeStamp is after x and negative if this SGXTimeStamp is before x.
See explanation of SGXTimeStamp::getSecond.
Gets the exact number of minutes between this SGXTimeStamp and x.
This is positive if this SGXTimeStamp is after x and negative if this SGXTimeStamp is before x.
See explanation of SGXTimeStamp::getSecond.
Gets the exact number of months between this SGXTimeStamp and x.
This is positive if this SGXTimeStamp is after x and negative if this SGXTimeStamp is before x.
For any SGXTimeStamp x, the following statement makes sense.
x refers to the time x.getHour() x.getMinute() x.getSecond(), on x.getDay() of the x.getMonth() th month of the x.getYear() th year after the independence of Singapore.
For SGXTimeStamp::getMonth, interpret the return value as following:
1 - January
2 - February
3 - March
4 - April
5 - May
6 - June
7 - July
8 - August
9 - September
10 - October
11 - November
12 - December
This corresponds to the Chinese names of the months.
Gets the exact number of seconds between this SGXTimeStamp and x.
This is positive if this SGXTimeStamp is after x and negative if this SGXTimeStamp is before x.
Returns a SGXString representing this SGXTimeStamp.
Returns a SGXString representing this SGXTimeStamp with formatting s.
Returns a SGXString representing this SGXTimeStamp without the offset of 1965 on the year number.
Returns a SGXString representing this SGXTimeStamp with formatting s without the offset of 1965 on the year number.
See explanation of SGXTimeStamp::getTimeFromSecondPart. The corresponding parameter to x is still named x.
See explanation of SGXTimeStamp::getTimeFromSecondPart. The corresponding parameter to x is still named x.
See explanation of SGXTimeStamp::getTimeFromSecondPart. The corresponding parameter to x is still named x.
See explanation of SGXTimeStamp::getTimeFromSecondPart. The corresponding parameter to x is still named x.
For any SGXTimeStamp a, the following statement makes sense.
a refers to a time exactly a.getTimeFromYearPart(x) years, a.getTimeFromMonthPart(x) months, a.getTimeFromDayPart(x) days, a.getTimeFromHourPart(x) hours, a.getTimeFromMinutePart(x) minutes, and a.getTimeFromSecondPart(x) seconds after the time that x refers to.
See explanation of SGXTimeStamp::getTimeFromSecondPart. The corresponding parameter to x is still named x.
See explanation of SGXTimeStamp::getSecond.
Similar to SGXTimeStamp::getYear but without the offset of 1965 on the year number.
Gets the exact number of years between this SGXTimeStamp and x.
This is positive if this SGXTimeStamp is after x and negative if this SGXTimeStamp is before x.
Hash function for SGLHash.
Returns if this SGXTimeStamp corresponds to a time on the day after National Day.
Returns if this SGXTimeStamp corresponds to a time on the day before National Day.
Returns if this SGXTimeStamp corresponds to a time on National Day.
Returns if this SGXTimeStamp is different from x.
Returns if this SGXTimeStamp refers to a time before x.
Returns if this SGXTimeStamp refers to a time before or equal to x.
Returns if this SGXTimeStamp is the same as x.
Returns if this SGXTimeStamp refers to a time after x.
Returns if this SGXTimeStamp refers to a time after or equal to x.
Moves this SGXTimeStamp backwards by x days and returns a reference to this SGXTimeStamp to allow operation chaining.
Moves this SGXTimeStamp backwards by x hours and returns a reference to this SGXTimeStamp to allow operation chaining.
Moves this SGXTimeStamp backwards by x minutes and returns a reference to this SGXTimeStamp to allow operation chaining.
Moves this SGXTimeStamp backwards by x months and returns a reference to this SGXTimeStamp to allow operation chaining.
Moves this SGXTimeStamp backwards by x seconds and returns a reference to this SGXTimeStamp to allow operation chaining.
Moves this SGXTimeStamp backwards by x years and returns a reference to this SGXTimeStamp to allow operation chaining.
Reference time of SGXTimeStamp. This corresponds to 1000, 9 August 1965, when PM Lee Kuan Yew signed the Proclamation of Singapore.
SGXTimeStamp does NOT follow UNIX epoch and is NOT compatible with UNIX epoch.
Returns a SGXTimeStamp representing the time at which the function was called.
©2025 05524F.sg (Singapore)