Skip to content
SiteEmail

cohtml::ITimeZoneProvider

#include <ITimeZoneProvider.h>

Name
ITimeZoneProvider()
virtual~ITimeZoneProvider()
virtual voidGetLocalTimezoneName(double timeMsUtc, char * buffer, size_t maxBufferSize) =0
Returns the short name of the local timezone for a specific point in time. (e.g. EST, PDT)
virtual doubleGetDaylightSavingsOffset(double timeMsUtc) =0
Returns the daylight savings time offset (in milliseconds) for a specific point in time.
virtual doubleGetLocalTimeOffset(double timeMs, bool isTimeUtc) =0
Returns the local time offset (without DST) from UTC (in milliseconds) for a specific point in time. Must comply to the following spec https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-local-time-zone-adjustment.
ITimeZoneProvider()
virtual ~ITimeZoneProvider()
virtual void GetLocalTimezoneName(
double timeMsUtc,
char * buffer,
size_t maxBufferSize
) =0

Returns the short name of the local timezone for a specific point in time. (e.g. EST, PDT)

Parameters:

  • timeMsUtc UTC time point in milliseconds
  • buffer a zero terminated buffer to fill the result
  • maxBufferSize the max size of the buffer
virtual double GetDaylightSavingsOffset(
double timeMsUtc
) =0

Returns the daylight savings time offset (in milliseconds) for a specific point in time.

Parameters:

  • timeMsUtc UTC time point in milliseconds

Return: the daylight savings time offset

virtual double GetLocalTimeOffset(
double timeMs,
bool isTimeUtc
) =0

Returns the local time offset (without DST) from UTC (in milliseconds) for a specific point in time. Must comply to the following spec https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-local-time-zone-adjustment.

Parameters:

  • timeMs a time point in milliseconds when isTimeUtc is true the time point is in the UTC time zone when isTimeUtc is false the time point is in the local time zone
  • isTimeUtc whether timeMs is in the UTC or local time zone

Return: the offset of the local time zone from UTC at timeMs