/[cabestan]/cabestan.c
ViewVC logotype

Diff of /cabestan.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1 by ben, Sun Oct 4 20:33:09 2009 UTC revision 3 by ben, Mon Oct 5 01:58:05 2009 UTC
# Line 0  Line 1 
1    #include <glib.h>
2    gchar* format_time (float secs) {
3            unsigned int hh, mm, ss, ms;
4            gchar* markup;
5    
6            hh = mm = ss = 0;
7    
8            if (secs >= 3600.0f) {
9                    hh    = (unsigned int) (secs / 3600.0f);
10                    secs -= (float) hh * 3600.0f;
11            }
12            if (secs >= 60.0f) {
13                    mm    = (unsigned int) (secs / 60.0f);
14                    secs -= (float) mm * 60.0f;
15            }
16            if (secs >= 0.0) {
17                    ss    = (unsigned int) secs;
18                    secs -= (float) ss;
19            }
20            ms = secs * 1000000;
21            
22            markup = g_markup_printf_escaped ("<span weight=\"bold\">%02d:%02d:%02d.%06u</span>", hh, mm, ss, ms);
23            return markup;
24    }

Legend:
Removed from v.1  
changed lines
  Added in v.3

  ViewVC Help
Powered by ViewVC 1.1.26