Archived

This topic is now archived and is closed to further replies.

re-formating time

This topic is 5775 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
For dates (maybe not quite what you want) -> ctime()

Otherwise, do it by hand
  
unsigned long time = whatever
unsigned 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 );

Share this post


Link to post
Share on other sites