micro-utils/libmu/duration.h

28 lines
386 B
C
Raw Normal View History

2023-12-04 18:51:07 +00:00
#ifndef _DURATION_H
#define _DURATION_H
#include <string.h>
unsigned long long parse_uint(const char *str) {
char *p = NULL;
unsigned long long res = strtoull(str, &p, 0);
if (*p)
return 0;
return res;
}
unsigned long long mu_parse_duration(const char *arg) {
if (strchr(arg, '.')) {
}
else
return parse_uint(arg) * 1000000;
return 0;
}
#endif