Advertisement

re-formating time

Started by February 20, 2002 04:16 AM
1 comment, last by foonk 23 years ago
hi, i was woundering if theres an easy way to reformat milliseconds into something like mm:ss or even hh:mm:ss ?? or if theres anywhere you poeple can point me to on he net that night help, thanks.
For dates (maybe not quite what you want) -> ctime()

Otherwise, do it by hand
  unsigned long time = whateverunsigned short ms = time % 1000;time /= 1000;unsigned short s = time % 60;time /= 60;unsigned short m = time % 60;time /= 60;unsigned short h = time % 24;time /= 24;printf( "%u days %02u:%02u:%02u.%03u", time, h,m,s,ms );  
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Advertisement
thanks heaps fruny

This topic is closed to new replies.

Advertisement