用户1340774522 :今日微软迷惑行为:微软在 Win32 API 中没有提供便捷的获取文件状态最后改动时间(对应 Unix 和 POSIX 中的 ctime)的方法[1],在 UCRT 对 POSIX 子集的 stat 函数实现中不顾相关标准[2]直接令 ctime 表示文件的创建时间[3]。ctime 在 POSIX 本应是非常明确的定义,但这一错误的解释方式和实现污染到了下游很多地方,Windows 平台的 Git[4]和 CPython[5]中 ctime 至今仍表示“创建时间”。

[1] https://stackoverflow.com/questions/12495784/windows-and-ctime-st-ctime
[2] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html
[3] https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/stat-functions
[4] https://github.com/git-for-windows/git/issues/1000#issuecomment-301611003
[5] https://docs.python.org/3/library/stat.html
  2020-11-21 22:27:48  举报 收藏 操作
 转发  评论  赞[0] 
评论只显示前140字:

 
还没有人针对这条微博发表评论!