GetTime


SUBMITTED BY: Guest

DATE: Feb. 12, 2014, 6:44 p.m.

FORMAT: Text only

SIZE: 432 Bytes

HITS: 1126

  1. unsigned int GetTime()
  2. {
  3. unsigned int value;
  4. struct tm *newtime;
  5. time_t long_time;
  6. time(&long_time);
  7. newtime = localtime(&long_time);
  8. value = ((newtime->tm_sec) % 10)+((newtime->tm_sec) /10)*16
  9. +((((newtime->tm_min) % 10)+((newtime->tm_min) /10)*16) << 8)
  10. +((((newtime->tm_hour) % 10)+((newtime->tm_hour)/10)*16) << 16);
  11. return(value);
  12. }

comments powered by Disqus