Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef struct
- {
- sgUInt year;
- sgUInt month;
- sgUInt day;
- sgBool correction;
- } sgDate;
- sgUShort GenTimeStamp(sgUShort year, sgUShort month, sgUShort day, sgBool correction)
- {
- // Bits: YYYYYmmmmmDDDDDk
- return (sgUShort)((year << 11) | (month << 6) | (day << 1) | correction ? 1 & 0x1 : 0 & 0x1);
- }
- sgDate GetDateFromTimeStamp(sgUInt timestamp)
- {
- sgDate date;
- date.year = (timestamp >> 11) & 0x1F;
- date.month = (timestamp >> 6) & 0x1F;
- date.day = (timestamp >> 1) & 0x1F;
- date.correction = timestamp & 0x1;
- return date;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement