diff options
Diffstat (limited to 'smtk-import')
-rw-r--r-- | smtk-import/smartrak.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/smtk-import/smartrak.c b/smtk-import/smartrak.c index e102c1abd..3fd8db6de 100644 --- a/smtk-import/smartrak.c +++ b/smtk-import/smartrak.c @@ -118,15 +118,11 @@ static void smtk_time_to_tm(char *t_buffer, struct tm *tm_date) */ static unsigned int smtk_time_to_secs(char *t_buffer) { - char *temp; - unsigned int hr, min, sec; + unsigned int n, hr, min, sec; if (!same_string(t_buffer, "")) { - temp = rindex(copy_string(t_buffer), ' '); - hr = atoi(strtok(temp, ":")); - min = atoi(strtok(NULL, ":")); - sec = atoi(strtok(NULL, "\0")); - return((((hr*60)+min)*60)+sec); + n = sscanf(t_buffer, "%*m[/0-9] %d:%d:%d ", &hr, &min, &sec); + return((n == 3) ? (((hr*60)+min)*60)+sec : 0); } else { return 0; } |