PRTimeParameters 编辑

A representation of time zone information.

Syntax

 #include <prtime.h>

 typedef struct PRTimeParameters {
     PRInt32 tp_gmt_offset;
     PRInt32 tp_dst_offset;
 } PRTimeParameters;

Description

Each geographic location has a standard time zone, and if Daylight Saving Time (DST) is practiced, a daylight time zone. The PRTimeParameters structure represents the local time zone information in terms of the offset (in seconds) from GMT. The overall offset is broken into two components:

tp_gmt_offset
The offset of the local standard time from GMT.
tp_dst_offset
If daylight savings time (DST) is in effect, the DST adjustment from the local standard time. This is most commonly 1 hour, but may also be 30 minutes or some other amount. If DST is not in effect, the tp_dst_offset component is 0.

For example, the US Pacific Time Zone has both a standard time zone (Pacific Standard Time, or PST) and a daylight time zone (Pacific Daylight Time, or PDT).

  • In PST, the local time is 8 hours behind GMT, so tp_gmt_offset is -28800 seconds. tp_dst_offset is 0, indicating that daylight saving time is not in effect.
  • In PDT, the clock is turned forward by one hour, so the local time is 7 hours behind GMT. This is broken down as -8 + 1 hours, so tp_gmt_offset is -28800 seconds, and tp_dst_offset is 3600 seconds.

A second example is Japan, which is 9 hours ahead of GMT. Japan does not use daylight saving time, so the only time zone is Japan Standard Time (JST). In JST tp_gmt_offset is 32400 seconds, and tp_dst_offset is 0.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:67 次

字数:1972

最后编辑:8年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文