X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Finclude%2Fcore%2Ftime.h;h=a9ca72f01a2dbfecc34a9251011f1b3afccb0994;hb=0c9e3aa9ba3948e88a0241861b75a002085eeccd;hp=f1a1dd5f9e17add0c03ef2f4fd9ca1f151d5330c;hpb=dfb8c3997e59f23727872d981b19ea59023a4ad5;p=sysdb.git diff --git a/src/include/core/time.h b/src/include/core/time.h index f1a1dd5..a9ca72f 100644 --- a/src/include/core/time.h +++ b/src/include/core/time.h @@ -41,7 +41,7 @@ extern "C" { * The time, in nano-seconds, since the epoch. */ typedef uint64_t sdb_time_t; -#define PRIscTIME PRIu64 +#define PRIsdbTIME PRIu64 #define SECS_TO_SDB_TIME(s) ((sdb_time_t)(s) * (sdb_time_t)1000000000) #define SDB_TIME_TO_SECS(t) ((t) / (sdb_time_t)1000000000) @@ -74,11 +74,24 @@ int sdb_sleep(sdb_time_t reg, sdb_time_t *rem); size_t -sdb_strftime(char *s, size_t len, const char *format, sdb_time_t); +sdb_strftime(char *s, size_t len, sdb_time_t); size_t sdb_strfinterval(char *s, size_t len, sdb_time_t interval); +/* + * sdb_strpunit: + * Parse the specified string as a time unit. + * "Y" (year), "M" (month), "D" (day), "h" (hour), "m" (minute), "s" (second), + * "ms" (milli-second), "us" (micro-second), "ns" (nano-second). + * + * Returns: + * - the time interval corresponding to the specified unit on success + * - 0 else + */ +sdb_time_t +sdb_strpunit(const char *s); + #ifdef __cplusplus } /* extern "C" */ #endif