aboutsummaryrefslogtreecommitdiff
path: root/lib/lib.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2018-01-06 15:43:17 -0600
committerRob Landley <rob@landley.net>2018-01-06 15:43:17 -0600
commitb432aee484bfca4d53cdce13343e6ee5c850d0f3 (patch)
tree0edd004bb051adf96aee91893e44324a784871ce /lib/lib.c
parent73690e9ebb24868a996567fdbe523ddc0a3c1415 (diff)
downloadtoybox-b432aee484bfca4d53cdce13343e6ee5c850d0f3.tar.gz
Move millitime() into lib.c.
Diffstat (limited to 'lib/lib.c')
-rw-r--r--lib/lib.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 8a818575..7f5fbbda 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -1353,7 +1353,16 @@ long environ_bytes()
long bytes = sizeof(char *);
char **ev;
- for (ev = environ; *ev; ev++)
- bytes += sizeof(char *) + strlen(*ev) + 1;
+ for (ev = environ; *ev; ev++) bytes += sizeof(char *) + strlen(*ev) + 1;
+
return bytes;
}
+
+// Return unix time in milliseconds
+long long millitime(void)
+{
+ struct timespec ts;
+
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ return ts.tv_sec*1000+ts.tv_nsec/1000000;
+}