Commit 253fe31c authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Don't show h: in h:mm:ss when h is 0 in secstotimestr.

parent 3b6a320b
...@@ -115,10 +115,22 @@ char *mstrtime( char *psz_buffer, mtime_t date ) ...@@ -115,10 +115,22 @@ char *mstrtime( char *psz_buffer, mtime_t date )
*/ */
char *secstotimestr( char *psz_buffer, int i_seconds ) char *secstotimestr( char *psz_buffer, int i_seconds )
{ {
snprintf( psz_buffer, MSTRTIME_MAX_SIZE, "%d:%2.2d:%2.2d", int i_hours, i_mins;
(int) (i_seconds / (60 *60)), i_mins = i_seconds / 60;
(int) ((i_seconds / 60) % 60), i_hours = i_mins / 60 ;
(int) (i_seconds % 60) ); if( i_hours )
{
snprintf( psz_buffer, MSTRTIME_MAX_SIZE, "%d:%2.2d:%2.2d",
(int) i_hours,
(int) (i_mins % 60),
(int) (i_seconds % 60) );
}
else
{
snprintf( psz_buffer, MSTRTIME_MAX_SIZE, "%2.2d:%2.2d",
(int) i_mins ,
(int) (i_seconds % 60) );
}
return( psz_buffer ); return( psz_buffer );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment