From f2f4f0d94a5280e15d89c25832825bb3ce65d2fd Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sun, 28 Jun 2020 22:18:26 +0200 Subject: server: Some code cleanup --- util.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'util.c') 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; +} -- cgit v1.2.3-54-g00ecf