MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / now

Method now

Libraries/Time/Time.cpp:41–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39const char* SC::Time::Absolute::ParseResult::getDay() const { return dayName; }
40
41SC::Time::Realtime SC::Time::Realtime::now()
42{
43#if SC_PLATFORM_WINDOWS
44 struct _timeb t;
45 _ftime_s(&t);
46 return static_cast<int64_t>(t.time) * 1000 + t.millitm;
47#else
48 struct timespec nowTimeSpec;
49 clock_gettime(CLOCK_REALTIME, &nowTimeSpec);
50 constexpr int64_t nanosecondsToMilliseconds = 1000 * 1000;
51 constexpr int64_t roundingNanoseconds = nanosecondsToMilliseconds / 2;
52 return static_cast<int64_t>(nowTimeSpec.tv_sec) * 1000 +
53 (static_cast<int64_t>(nowTimeSpec.tv_nsec) + roundingNanoseconds) / nanosecondsToMilliseconds;
54#endif
55}
56
57SC::Time::Monotonic SC::Time::Monotonic::now()
58{

Callers 1

buildRateLimitMessageFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected