Created
February 12, 2012 19:40
-
-
Save odrobnik/1810427 to your computer and use it in GitHub Desktop.
Decoding a dos date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
long l = 1078768689; | |
// dosdate spec: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724247(v=vs.85).aspx | |
int year = ((l>>25)&127) + 1980; // 7 bits | |
int month = (l>>21)&15; // 4 bits | |
int day = (l>>16)&31; // 5 bits | |
int hour = (l>>11)&31; // 5 bits | |
int minute = (l>>5)&63; // 6 bits | |
int second = (l&31) * 2; // 5 bits |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment