aboutsummaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2020-06-28 22:18:26 +0200
committerTom Smeding <tom.smeding@gmail.com>2020-06-28 22:18:26 +0200
commitf2f4f0d94a5280e15d89c25832825bb3ce65d2fd (patch)
tree455518874f795014abe0a69f43f97aacbba962ea /util.c
parenteef139412c15d236fb797262a36f9e75fea860d9 (diff)
server: Some code cleanup
Diffstat (limited to 'util.c')
-rw-r--r--util.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/util.c b/util.c
index 6887ce9..cc7ccc0 100644
--- a/util.c
+++ b/util.c
@@ -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;
+}