struct stat 时间是 GMT 吗?
struct stat 中的字段之一是 st_mtime。我假设这是自 1970 年 1 月 1 日以来的秒数。那是 GMT 还是当地时间?
One of the fields in struct stat is st_mtime. I assume that is seconds since jan 1, 1970. Is that GMT or local time?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
time_t
类型表示自 1970 年 1 月 1 日 00:00 UTC 以来经过的秒数(该时刻称为“纪元”,在世界各地的同一时刻发生)。您可以将“UTC”视为与“GMT”相同的含义(有关详细信息,请参阅闰秒关于非常小的差异)。请注意,您应该始终使用
localtime()
和mktime()
函数来转换time_t
类型的值,而不是添加或减去值往返于本地时区表示。The
time_t
type represents the number of seconds that have passed since 1 January 1970 00:00 UTC (that moment in time is called the "epoch" and happened at the same moment everywhere around the world). You can consider "UTC" to mean the same thing as "GMT" (see Leap Second for detail about the very small differences).Be aware that instead of adding or subtracting values from the
time_t
type, you should always use thelocaltime()
andmktime()
functions to convert to and from a local time zone representation.