diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2020-06-28 22:18:26 +0200 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2020-06-28 22:18:26 +0200 |
commit | f2f4f0d94a5280e15d89c25832825bb3ce65d2fd (patch) | |
tree | 455518874f795014abe0a69f43f97aacbba962ea /util.c | |
parent | eef139412c15d236fb797262a36f9e75fea860d9 (diff) |
server: Some code cleanup
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -7,3 +7,12 @@ i64 make_timestamp(void){ gettimeofday(&tv,NULL); return (i64)tv.tv_sec*1000000+tv.tv_usec; } + +bool parse_i64(const char *str, i64 *out) { + if (str[0] == '\0') return false; + char *endp; + i64 result = strtoll(str, &endp, 10); + if (*endp != '\0') return false; + *out = result; + return true; +} |