The Old New Thing

Why is the Win32 epoch January 1, 1601?

Public Service Announcement: This weekend marks the start of Daylight Saving Time in most parts of the United States. The structure records time in the form of 100-nanosecond intervals since January 1, 1601. Why was that date chosen? The Gregorian calendar operates on a 400-year cycle, and 1601 is the first year of the cycle that was ...

Working with ambiguous and invalid points in time in managed code

Public Service Announcement: Daylight Saving Time ends in most parts of the United States this weekend. I pointed out some time ago that Win32 and .NET deal with daylight saving time differently. Specifically, Win32 always deals with the time zone you are currently in (even if it's not the time zone that corresponds to the timestamp you are...

Why can't I convert a time zone abbreviation into a time zone?

Suppose you have a string of the form . How can you parse this into something your program can manipulate, like say a or a ? Basically, you can't in the general case. The time zone abbreviation CST is ambiguous. It could mean U.S./Canada Central Standard Time, Australian Central Standard Time, China Standard Time, or Cuba Summer Time. ...

Don't be so fast to discount those oddball time zones

This weekend marks the beginning of Daylight Saving Time in most parts of the United States, the first year under the new transition rules in the Energy Policy Act of 2005. Pay extra attention to your clocks this weekend. If you have a device that automatically adjusts for Daylight Saving Time, and it hasn't been updated for the new ...

Why can’t you treat a FILETIME as an __int64?

The FILETIME structure represents a 64-bit value in two parts: typedef struct _FILETIME { DWORD dwLowDateTime; DWORD dwHighDateTime; } FILETIME, *PFILETIME; You may be tempted to take the entire FILETIME structure and access it directly as if it were an __int64. After all, its memory layout exactly matches that of a 64-bit (little-...

Why do timestamps change when I copy files to a floppy?

Floppy disks use the FAT filesystem, as do DOS-based and Windows 95-based operating systems. On the other hand, Windows NT-based systems (Windows 2000, XP, 2003, ...) tend to use the NTFS filesystem. (Although you can format a drive as FAT on Windows NT-based systems, it is not the default option.) The NTFS and FAT filesystems store ...