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)
175 get_mono(&ts); 175 get_mono(&ts);
176 return ts.tv_sec * 1000000ULL + ts.tv_nsec/1000; 176 return ts.tv_sec * 1000000ULL + ts.tv_nsec/1000;
177} 177}
178unsigned long long FAST_FUNC monotonic_ms(void)
179{
180 struct timespec ts;
181 get_mono(&ts);
182 return ts.tv_sec * 1000ULL + ts.tv_nsec/1000000;
183}
178unsigned FAST_FUNC monotonic_sec(void) 184unsigned FAST_FUNC monotonic_sec(void)
179{ 185{
180 struct timespec ts; 186 struct timespec ts;
@@ -196,6 +202,12 @@ unsigned long long FAST_FUNC monotonic_us(void)
196 gettimeofday(&tv, NULL); 202 gettimeofday(&tv, NULL);
197 return tv.tv_sec * 1000000ULL + tv.tv_usec; 203 return tv.tv_sec * 1000000ULL + tv.tv_usec;
198} 204}
205unsigned long long FAST_FUNC monotonic_ms(void)
206{
207 struct timeval tv;
208 gettimeofday(&tv, NULL);
209 return tv.tv_sec * 1000ULL + tv.tv_usec / 1000;
210}
199unsigned FAST_FUNC monotonic_sec(void) 211unsigned FAST_FUNC monotonic_sec(void)
200{ 212{
201 return time(NULL); 213 return time(NULL);