Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include <time.h>
  2.  
  3. #pragma pack (push,1)
  4. typedef struct{
  5. unsigned Sec :5;
  6. unsigned Min :6;
  7. unsigned Hour :5;
  8. unsigned Day :5;
  9. unsigned Month :4;
  10. unsigned Year :7;
  11. }FatDate_t;
  12. #pragma pack (pop)
  13.  
  14. DWORD get_fattime(DWORD UNIX_timestemp){
  15. time_t rawtime;
  16. struct tm * timeinfo;
  17. rawtime=UNIX_timestemp;
  18. timeinfo = localtime (&rawtime);
  19. DWORD FatDate=0;
  20. FatDate_t *FDate=(FatDate_t *)&FatDate;
  21. FDate->Sec=timeinfo->tm_sec>>1;
  22. FDate->Min=timeinfo->tm_min;
  23. FDate->Hour=timeinfo->tm_hour;
  24. FDate->Day=timeinfo->tm_mday;
  25. FDate->Month=timeinfo->tm_mon+1;
  26. FDate->Year=timeinfo->tm_year+48;
  27.  
  28. return FatDate;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement