mirror of
https://github.com/thunderbrewhq/bc.git
synced 2025-12-12 01:52:30 +00:00
* feat(bc): implement timekeeping * fix(time): Milliseconds and Seconds return storage should be 64-bit * fix(time): nsec should be explicitly cast to uint32 * test(time): rudimentary tests for timekeeping * fix(time): check properly for timestamp + nsec overflows in MakeTime and BreakTime * fix(time): include UNIX time headers on Mac, too * test(time): test can tolerate system hiccups
39 lines
663 B
C++
39 lines
663 B
C++
#ifndef BC_TIME_TIME_HPP
|
|
#define BC_TIME_TIME_HPP
|
|
|
|
#include "bc/time/Types.hpp"
|
|
|
|
#include <cstdint>
|
|
|
|
namespace Blizzard {
|
|
namespace Time {
|
|
|
|
int32_t ToUnixTime(Timestamp timestamp);
|
|
|
|
Timestamp FromUnixTime(int32_t unixTime);
|
|
|
|
// Win32 FILETIME to y2k
|
|
Timestamp FromWinFiletime(uint64_t winTime);
|
|
|
|
uint64_t ToWinFiletime(Timestamp y2k);
|
|
|
|
Timestamp GetTimestamp();
|
|
|
|
int32_t GetTimeElapsed(uint32_t start, uint32_t end);
|
|
|
|
Timestamp MakeTime(const TimeRec& date);
|
|
|
|
void BreakTime(Timestamp timestamp, TimeRec& date);
|
|
|
|
uint64_t Nanoseconds();
|
|
|
|
uint64_t Microseconds();
|
|
|
|
uint64_t Milliseconds();
|
|
|
|
uint64_t Seconds();
|
|
|
|
} // namespace Time
|
|
} // namespace Blizzard
|
|
|
|
#endif
|