~ubuntu-branches/ubuntu/lucid/gecko-mediaplayer/lucid-proposed

« back to all changes in this revision

Viewing changes to src/libgmlib/gm_strfuncs.c

  • Committer: Bazaar Package Importer
  • Author(s): Cesare Tirabassi
  • Date: 2009-09-24 13:55:35 UTC
  • mfrom: (0.2.8 upstream)
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20090924135535-99jk1ar22n70h95j
Tags: upstream-0.9.8
ImportĀ upstreamĀ versionĀ 0.9.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
            }
60
60
        }
61
61
    }
62
 
}
 
 
b'\\ No newline at end of file'
 
62
}
 
63
 
 
64
gint gm_str_hms_in_seconds(gchar *timestr)
 
65
{
 
66
        gchar **split;
 
67
        gint ret = 0;
 
68
        
 
69
        split = g_strsplit(timestr,":",0);
 
70
 
 
71
        switch (g_strv_length(split)) {
 
72
                case 1: 
 
73
                        ret = g_ascii_strtod(split[0],NULL);
 
74
                        break;
 
75
                case 2:
 
76
                        ret = g_ascii_strtod(split[0],NULL) * 60 + g_ascii_strtod(split[1],NULL);
 
77
                        break;
 
78
                case 3:
 
79
                        ret = g_ascii_strtod(split[0],NULL) * 3600 + g_ascii_strtod(split[1],NULL) * 60 + g_ascii_strtod(split[2],NULL);
 
80
                        break;
 
81
        }
 
82
        
 
83
        g_strfreev(split);
 
84
        
 
85
        return ret;
 
86
}
 
87