prtimeparameters.rst (1689B)
1 PRTimeParameters 2 ================ 3 4 A representation of time zone information. 5 6 7 Syntax 8 ------ 9 10 .. code:: 11 12 #include <prtime.h> 13 14 typedef struct PRTimeParameters { 15 PRInt32 tp_gmt_offset; 16 PRInt32 tp_dst_offset; 17 } PRTimeParameters; 18 19 20 Description 21 ----------- 22 23 Each geographic location has a standard time zone, and if Daylight 24 Saving Time (DST) is practiced, a daylight time zone. The 25 :ref:`PRTimeParameters` structure represents the local time zone 26 information in terms of the offset (in seconds) from GMT. The overall 27 offset is broken into two components: 28 29 ``tp_gmt_offset`` 30 The offset of the local standard time from GMT. 31 32 ``tp_dst_offset`` 33 If daylight savings time (DST) is in effect, the DST adjustment from 34 the local standard time. This is most commonly 1 hour, but may also 35 be 30 minutes or some other amount. If DST is not in effect, the 36 tp_dst_offset component is 0. 37 38 For example, the US Pacific Time Zone has both a standard time zone 39 (Pacific Standard Time, or PST) and a daylight time zone (Pacific 40 Daylight Time, or PDT). 41 42 - In PST, the local time is 8 hours behind GMT, so ``tp_gmt_offset`` is 43 -28800 seconds. ``tp_dst_offset`` is 0, indicating that daylight 44 saving time is not in effect. 45 46 - In PDT, the clock is turned forward by one hour, so the local time is 47 7 hours behind GMT. This is broken down as -8 + 1 hours, so 48 ``tp_gmt_offset`` is -28800 seconds, and ``tp_dst_offset`` is 3600 49 seconds. 50 51 A second example is Japan, which is 9 hours ahead of GMT. Japan does not 52 use daylight saving time, so the only time zone is Japan Standard Time 53 (JST). In JST ``tp_gmt_offset`` is 32400 seconds, and ``tp_dst_offset`` 54 is 0.