Go to the documentation of this file.
92 return (
double)(thisPtr->
m_msTime % (24 * 60 * 60 * 1000)) * 0.001;
146 return 9223372036854775807LL;
161 utctm.tm_year = info->
m_year - 1900;
162 utctm.tm_mon = info->
m_month - 1;
163 utctm.tm_mday = info->
m_day;
165 utctm.tm_hour = info->
m_hour;
175 epoch = (int64_t)_mkgmtime(&utctm);
177 epoch = (int64_t)timegm(&utctm);
180 rv = (epoch * 1000LL) + (info->
m_nano / 1000000) + ((int64_t) info->
m_utcOffset * 60000);
196 t = (__time64_t)(thisPtr->
m_msTime / 1000);
197 if (_gmtime64_s(&tmUtc, &t))
203 #elif (defined(__arm__) && defined(__ARMCC_VERSION))
204 #warning Function is not thread-safe for this platform/toolchain
206 t = (time_t)(thisPtr->
m_msTime / 1000);
207 struct tm* tmUtcPtr = gmtime(&t);
213 memcpy(&tmUtc, tmUtcPtr,
sizeof(tmUtc));
216 t = (time_t)(thisPtr->
m_msTime / 1000);
217 if (gmtime_r(&t, &tmUtc) == 0)
225 info->
m_day = (uint8_t) tmUtc.tm_mday;
226 info->
m_hour = (uint8_t) tmUtc.tm_hour;
227 info->
m_minute = (uint8_t) tmUtc.tm_min;
228 info->
m_month = (uint8_t) tmUtc.tm_mon + 1;
230 info->
m_second = (uint8_t) tmUtc.tm_sec;
231 info->
m_year = (uint16_t)(tmUtc.tm_year + 1900);
249 sprintf(buffer,
"%04d/%02d/%02d %02d:%02d:%02d.%03d"
265 extern int64_t XsTime_utcToLocalValue;
266 extern int64_t XsTime_localToUtcValue;
void XsTimeStamp_utcToLocalTime_ms(struct XsTimeStamp const *thisPtr, struct XsTimeStamp *local, int64_t utcOffset)
Convert the supplied time from (assumed) UTC to local time, using the offset in utcOffset.
int64_t XsTimeStamp_now(XsTimeStamp *dest)
Returns the current time in ms since the epoch (Jan 1st 1970)
void XsTimeStamp_localToUtcTime2(struct XsTimeStamp const *thisPtr, struct XsTimeStamp *utc, const struct XsTimeInfo *info)
Convert the supplied time from (assumed) local time to UTC, using the offset in info.
uint8_t m_hour
The hour (if time is valid)
int16_t m_utcOffset
Offset to UTC time in minutes. This value can be added to the stored time to get UTC time.
double XsTimeStamp_timeOfDay(const XsTimeStamp *thisPtr)
Get the time of day component of the stored timestamp in seconds as a double precision value.
void XsTimeStamp_localToUtcTime_ms(struct XsTimeStamp const *thisPtr, struct XsTimeStamp *utc, int64_t utcOffset)
Convert the supplied time from (assumed) local time to UTC, using the offset in utcOffset.
int32_t XsTimeStamp_hourPart(const XsTimeStamp *thisPtr)
Returns the hours part of the time (in the range 0-23)
int32_t XsTimeStamp_minutePart(const XsTimeStamp *thisPtr)
Returns the minutes part of the time (in the range 0-59)
int64_t XsTimeStamp_maxValue(void)
Returns the maximum value of an XsTimeStamp.
uint8_t m_valid
Validity indicator.
int32_t XsTimeStamp_secondPart(const XsTimeStamp *thisPtr)
Returns the seconds part of the time (in the range 0-59)
uint8_t m_second
The second (if time is valid)
uint8_t m_day
The day of the month (if date is valid)
void XsTimeStamp_utcToLocalTime(struct XsTimeStamp const *thisPtr, struct XsTimeStamp *local)
Convert the supplied time from (assumed) UTC to local time, using the system's local time zone knowle...
int32_t XsTimeStamp_milliSecondPart(const XsTimeStamp *thisPtr)
Returns the millisecond part of the time (in the range 0-999)
void XsTimeStamp_toString(struct XsTimeStamp const *thisPtr, struct XsString *result)
Converts the timestamp into an XsString object in format YYYY/MM/DD hh:mm:ss.nnn.
uint32_t m_nano
Nanosecond part of the time.
void XsTimeStamp_utcToLocalTime2(struct XsTimeStamp const *thisPtr, struct XsTimeStamp *local, const struct XsTimeInfo *info)
Convert the supplied time from (assumed) UTC to local time, using the offset in info.
void XsTimeStamp_setMilliSecondTime(XsTimeStamp *thisPtr, int64_t t)
Set the stored time to miliseconds.
int64_t XsTimeStamp_secondTime(const XsTimeStamp *thisPtr)
Returns the number of seconds elapsed since the epoch as stored in the XsTimeStamp.
uint8_t m_month
The month (if date is valid)
int64_t XsTimeStamp_fromTimeInfo(struct XsTimeStamp *thisPtr, const struct XsTimeInfo *info)
Creates a (UTC) XsTimeStamp from an XsTimeInfo object.
uint16_t m_year
The year (if date is valid)
uint8_t m_minute
The minute (if time is valid)
void XsTimeStamp_localToUtcTime(struct XsTimeStamp const *thisPtr, struct XsTimeStamp *utc)
Convert the supplied time from (assumed) local time to UTC, using the system's local time zone knowle...
int64_t XsTime_timeStampNow(XsTimeStamp *now)
Returns the current time in ms since the epoch (Jan 1st 1970)
int64_t m_msTime
The timestamp value.
void XsTimeStamp_toTimeInfo(struct XsTimeStamp const *thisPtr, struct XsTimeInfo *info)
Converts the timestamp into an XsTimeInfo object.
void XsString_assign(XsString *thisPtr, XsSize count, const char *src)
Reinitializes the XsArray with space for count items and copies them from src.
A 0-terminated managed string of characters.
This class contains method to set, retrieve and compare timestamps.
A structure for storing Time values.