aboutsummaryrefslogtreecommitdiff
path: root/libbb/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/time.c')
-rw-r--r--libbb/time.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libbb/time.c b/libbb/time.c
index 82a0fa1fa..45ae6f3a7 100644
--- a/libbb/time.c
+++ b/libbb/time.c
@@ -175,6 +175,12 @@ unsigned long long FAST_FUNC monotonic_us(void)
get_mono(&ts);
return ts.tv_sec * 1000000ULL + ts.tv_nsec/1000;
}
+unsigned long long FAST_FUNC monotonic_ms(void)
+{
+ struct timespec ts;
+ get_mono(&ts);
+ return ts.tv_sec * 1000ULL + ts.tv_nsec/1000000;
+}
unsigned FAST_FUNC monotonic_sec(void)
{
struct timespec ts;
@@ -196,6 +202,12 @@ unsigned long long FAST_FUNC monotonic_us(void)
gettimeofday(&tv, NULL);
return tv.tv_sec * 1000000ULL + tv.tv_usec;
}
+unsigned long long FAST_FUNC monotonic_ms(void)
+{
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ return tv.tv_sec * 1000ULL + tv.tv_usec / 1000;
+}
unsigned FAST_FUNC monotonic_sec(void)
{
return time(NULL);