add clockGetMillis()
This commit is contained in:
@@ -44,4 +44,10 @@ void clockGettime(struct timespec* t) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long long clockGetMillis() {
|
||||||
|
struct timespec t;
|
||||||
|
clockGettime(&t);
|
||||||
|
return t.tv_sec*1000LL + t.tv_nsec / 1000000;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ebusd
|
} // namespace ebusd
|
||||||
|
|||||||
@@ -31,6 +31,11 @@ namespace ebusd {
|
|||||||
*/
|
*/
|
||||||
void clockGettime(struct timespec* t);
|
void clockGettime(struct timespec* t);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current system time in milliseconds since the Epoch.
|
||||||
|
*/
|
||||||
|
long long clockGetMillis();
|
||||||
|
|
||||||
} // namespace ebusd
|
} // namespace ebusd
|
||||||
|
|
||||||
#endif // LIB_UTILS_CLOCK_H_
|
#endif // LIB_UTILS_CLOCK_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user