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