Time Shield Library
C++ library for working with time
Loading...
Searching...
No Matches
Time zone conversion helpers
ts_t time_shield::cet_to_gmt (ts_t cet)
 Convert Central European Time to Greenwich Mean Time.
 
ts_t time_shield::eet_to_gmt (ts_t eet)
 Convert Eastern European Time to Greenwich Mean Time.
 
bool time_shield::is_us_eastern_dst_local (const DateTimeStruct &dt)
 Check if local US Eastern time uses DST.
 
ts_t time_shield::et_to_gmt (ts_t et)
 Convert US Eastern Time (New York, EST/EDT) to GMT (UTC).
 
ts_t time_shield::gmt_to_et (ts_t gmt)
 Convert GMT (UTC) to US Eastern Time (New York, EST/EDT).
 
ts_t time_shield::ny_to_gmt (ts_t ny)
 Convert New York Time to GMT (UTC).
 
ts_t time_shield::gmt_to_ny (ts_t gmt)
 Convert GMT (UTC) to New York Time.
 
ts_t time_shield::ct_to_gmt (ts_t ct)
 Convert US Central Time (America/Chicago, CST/CDT) to GMT (UTC).
 
ts_t time_shield::gmt_to_ct (ts_t gmt)
 Convert GMT (UTC) to US Central Time (America/Chicago, CST/CDT).
 
ts_t time_shield::gmt_to_cet (ts_t gmt)
 Convert Greenwich Mean Time to Central European Time.
 
ts_t time_shield::gmt_to_eet (ts_t gmt)
 Convert Greenwich Mean Time to Eastern European Time.
 
TIME_SHIELD_CONSTEXPR ts_t time_shield::to_utc (ts_t local, tz_t utc_offset) noexcept
 Convert local timestamp (seconds) to UTC using UTC offset.
 
TIME_SHIELD_CONSTEXPR ts_t time_shield::to_local (ts_t utc, tz_t utc_offset) noexcept
 Convert UTC timestamp (seconds) to local time using UTC offset.
 
TIME_SHIELD_CONSTEXPR ts_ms_t time_shield::to_utc_ms (ts_ms_t local_ms, tz_t utc_offset) noexcept
 Convert local timestamp (milliseconds) to UTC using UTC offset.
 
TIME_SHIELD_CONSTEXPR ts_ms_t time_shield::to_local_ms (ts_ms_t utc_ms, tz_t utc_offset) noexcept
 Convert UTC timestamp (milliseconds) to local time using UTC offset.
 
TIME_SHIELD_CONSTEXPR tz_t time_shield::utc_offset_of (const TimeZoneStruct &tz) noexcept
 Extract numeric UTC offset (in seconds) from TimeZoneStruct.
 

Detailed Description

Function Documentation

◆ cet_to_gmt()

ts_t time_shield::cet_to_gmt ( ts_t cet)
inline

Convert Central European Time to Greenwich Mean Time.

Parameters
cetTimestamp in seconds in CET.
Returns
Timestamp in seconds in GMT.

Definition at line 21 of file time_zone_conversions.hpp.

◆ ct_to_gmt()

ts_t time_shield::ct_to_gmt ( ts_t ct)
inline

Convert US Central Time (America/Chicago, CST/CDT) to GMT (UTC).

Parameters
ctTimestamp in seconds in CT.
Returns
Timestamp in seconds in GMT (UTC).

Definition at line 190 of file time_zone_conversions.hpp.

◆ eet_to_gmt()

ts_t time_shield::eet_to_gmt ( ts_t eet)
inline

Convert Eastern European Time to Greenwich Mean Time.

Parameters
eetTimestamp in seconds in EET.
Returns
Timestamp in seconds in GMT.

Definition at line 94 of file time_zone_conversions.hpp.

◆ et_to_gmt()

ts_t time_shield::et_to_gmt ( ts_t et)
inline

Convert US Eastern Time (New York, EST/EDT) to GMT (UTC).

Parameters
etTimestamp in seconds in ET.
Returns
Timestamp in seconds in GMT (UTC).

GMT in this library uses UTC. DST rules are guaranteed for 1987+; earlier years use 1987-2006 rules as a best-effort approximation.

Definition at line 154 of file time_zone_conversions.hpp.

◆ gmt_to_cet()

ts_t time_shield::gmt_to_cet ( ts_t gmt)
inline

Convert Greenwich Mean Time to Central European Time.

Parameters
gmtTimestamp in seconds in GMT.
Returns
Timestamp in seconds in CET.

Definition at line 204 of file time_zone_conversions.hpp.

◆ gmt_to_ct()

ts_t time_shield::gmt_to_ct ( ts_t gmt)
inline

Convert GMT (UTC) to US Central Time (America/Chicago, CST/CDT).

Parameters
gmtTimestamp in seconds in GMT (UTC).
Returns
Timestamp in seconds in CT.

Definition at line 197 of file time_zone_conversions.hpp.

◆ gmt_to_eet()

ts_t time_shield::gmt_to_eet ( ts_t gmt)
inline

Convert Greenwich Mean Time to Eastern European Time.

Parameters
gmtTimestamp in seconds in GMT.
Returns
Timestamp in seconds in EET.

Definition at line 239 of file time_zone_conversions.hpp.

◆ gmt_to_et()

ts_t time_shield::gmt_to_et ( ts_t gmt)
inline

Convert GMT (UTC) to US Eastern Time (New York, EST/EDT).

Parameters
gmtTimestamp in seconds in GMT (UTC).
Returns
Timestamp in seconds in ET.

GMT in this library uses UTC. DST rules are guaranteed for 1987+; earlier years use 1987-2006 rules as a best-effort approximation.

Definition at line 166 of file time_zone_conversions.hpp.

◆ gmt_to_ny()

ts_t time_shield::gmt_to_ny ( ts_t gmt)
inline

Convert GMT (UTC) to New York Time.

Parameters
gmtTimestamp in seconds in GMT (UTC).
Returns
Timestamp in seconds in ET.

Definition at line 183 of file time_zone_conversions.hpp.

◆ is_us_eastern_dst_local()

bool time_shield::is_us_eastern_dst_local ( const DateTimeStruct & dt)
inline

Check if local US Eastern time uses DST.

Parameters
dtLocal time in ET.
Returns
True if DST applies for the provided local timestamp.

Definition at line 101 of file time_zone_conversions.hpp.

◆ ny_to_gmt()

ts_t time_shield::ny_to_gmt ( ts_t ny)
inline

Convert New York Time to GMT (UTC).

Parameters
nyTimestamp in seconds in ET.
Returns
Timestamp in seconds in GMT (UTC).

Definition at line 176 of file time_zone_conversions.hpp.

◆ to_local()

TIME_SHIELD_CONSTEXPR ts_t time_shield::to_local ( ts_t utc,
tz_t utc_offset )
inlinenoexcept

Convert UTC timestamp (seconds) to local time using UTC offset.

Parameters
utcUTC timestamp in seconds.
utc_offsetUTC offset in seconds (e.g. CET=+3600, MSK=+10800, EST=-18000).
Returns
Local timestamp in seconds. If utc equals ERROR_TIMESTAMP, returns ERROR_TIMESTAMP.

Definition at line 43 of file time_zone_offset.hpp.

◆ to_local_ms()

TIME_SHIELD_CONSTEXPR ts_ms_t time_shield::to_local_ms ( ts_ms_t utc_ms,
tz_t utc_offset )
inlinenoexcept

Convert UTC timestamp (milliseconds) to local time using UTC offset.

Parameters
utc_msUTC timestamp in milliseconds.
utc_offsetUTC offset in seconds (will be converted to milliseconds).
Returns
Local timestamp in milliseconds. If utc_ms equals ERROR_TIMESTAMP, returns ERROR_TIMESTAMP.

Definition at line 61 of file time_zone_offset.hpp.

◆ to_utc()

TIME_SHIELD_CONSTEXPR ts_t time_shield::to_utc ( ts_t local,
tz_t utc_offset )
inlinenoexcept

Convert local timestamp (seconds) to UTC using UTC offset.

Parameters
localLocal timestamp in seconds.
utc_offsetUTC offset in seconds (e.g. CET=+3600, MSK=+10800, EST=-18000).
Returns
UTC timestamp in seconds. If local equals ERROR_TIMESTAMP, returns ERROR_TIMESTAMP.

Definition at line 34 of file time_zone_offset.hpp.

◆ to_utc_ms()

TIME_SHIELD_CONSTEXPR ts_ms_t time_shield::to_utc_ms ( ts_ms_t local_ms,
tz_t utc_offset )
inlinenoexcept

Convert local timestamp (milliseconds) to UTC using UTC offset.

Parameters
local_msLocal timestamp in milliseconds.
utc_offsetUTC offset in seconds (will be converted to milliseconds).
Returns
UTC timestamp in milliseconds. If local_ms equals ERROR_TIMESTAMP, returns ERROR_TIMESTAMP.

Definition at line 52 of file time_zone_offset.hpp.

◆ utc_offset_of()

TIME_SHIELD_CONSTEXPR tz_t time_shield::utc_offset_of ( const TimeZoneStruct & tz)
inlinenoexcept

Extract numeric UTC offset (in seconds) from TimeZoneStruct.

Parameters
tzTime zone descriptor.
Returns
UTC offset in seconds (local = utc + offset).

Definition at line 69 of file time_zone_offset.hpp.