Are Windows file timestamps timezone aware?

Are Windows file timestamps timezone aware?

回答

The time zone is an artefact of conversion from "instants" to a human-readable date-and-time in some calendar.

Computers do not like human-readable formats (not as much as humans, at least), so they usually store instants in a zone-neutral format. For instance, in the NTFS file system, time stamps are stored in UTC.

Hence, the file time modification is stored properly as long as whoever modifies it knows the current time. If your Windows system displays "13:19" and believes to be in the GMT-5 time zone, then it infers that the current instant is "18:19" in UTC, and writes as much in the NTFS entrails. However, if the OS displays "13:19" but believes to be in the GMT+3 time zone, then the OS is off by eight hours, even if, for the human looking at the screen, things seem fine.

Another point is that the file modification time is a property of the storage system in which the file is stored, e.g. a file system. When a file is "sent", then that time does not necessarily travels with it. Some archive formats (e.g. Zip) embed the file modification time along with the file. This does not apply to a file sent "as is", attached to an email, will not come with a file modification time.

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(20)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2020-07-03 NLog rolling file
2020-07-03 Custom date and time format strings
2020-07-03 NLog layout map to conversionPattern with log4net
2019-07-03 Javascript 面向对象编程(一):封装
2019-07-03 Javascript继承机制的设计思想
2019-07-03 __proto__ VS. prototype in JavaScript
2019-07-03 ClientScriptManager.RegisterClientScriptBlock Method 无效
点击右上角即可分享
微信分享提示