Mercurial > hg > svcore
diff base/RealTimeSV.cpp @ 1541:71207822a7e0 zoom
Provide fromMicroseconds (and test it)
author | Chris Cannam |
---|---|
date | Thu, 27 Sep 2018 15:53:34 +0100 |
parents | 48e9f538e6e9 |
children | 6415ac3becb6 |
line wrap: on
line diff
--- a/base/RealTimeSV.cpp Thu Sep 27 15:19:39 2018 +0100 +++ b/base/RealTimeSV.cpp Thu Sep 27 15:53:34 2018 +0100 @@ -67,6 +67,12 @@ } RealTime +RealTime::fromMicroseconds(int usec) +{ + return RealTime(usec / 1000000, (usec % 1000000) * 1000); +} + +RealTime RealTime::fromTimeval(const struct timeval &tv) { return RealTime(int(tv.tv_sec), int(tv.tv_usec * 1000));