/[cabestan]/cabestan.c
ViewVC logotype

Contents of /cabestan.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6 - (show annotations)
Mon Oct 5 11:41:40 2009 UTC (8 years ago) by ben
File MIME type: text/plain
File size: 566 byte(s)
better timeline display
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 foreground=\"darkgreen\"><big><b>%02d:%02d:%02d.%06u</b></big></span>", hh, mm, ss, ms);
23 return markup;
24 }

  ViewVC Help
Powered by ViewVC 1.1.26