mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-25 14:07:46 +00:00
Fix getTimeMs not returning correct unix epoch
Turned out high_resolution_clock did not return current UTC time. Use system_clock to fix it.
This commit is contained in:
parent
60d67952e4
commit
c6bd508ec7
1 changed files with 4 additions and 7 deletions
|
@ -17,17 +17,14 @@ std::string Core::Util::binaryToHexString( uint8_t* pBinData, uint16_t size )
|
|||
|
||||
uint64_t Core::Util::getTimeMs()
|
||||
{
|
||||
std::chrono::high_resolution_clock::time_point t1 = std::chrono::high_resolution_clock::now();
|
||||
auto now_ms = std::chrono::time_point_cast< std::chrono::milliseconds >( t1 ).time_since_epoch().count();
|
||||
|
||||
return now_ms;
|
||||
std::chrono::milliseconds epoch = std::chrono::duration_cast< std::chrono::milliseconds >(std::chrono::system_clock::now().time_since_epoch());
|
||||
return epoch.count();
|
||||
}
|
||||
|
||||
uint64_t Core::Util::getTimeSeconds()
|
||||
{
|
||||
std::chrono::high_resolution_clock::time_point t1 = std::chrono::high_resolution_clock::now();
|
||||
auto now = std::chrono::time_point_cast< std::chrono::seconds >( t1 ).time_since_epoch().count();
|
||||
return now;
|
||||
std::chrono::seconds epoch = std::chrono::duration_cast< std::chrono::seconds >(std::chrono::system_clock::now().time_since_epoch());
|
||||
return epoch.count();
|
||||
}
|
||||
|
||||
uint64_t Core::Util::getEorzeanTimeStamp()
|
||||
|
|
Loading…
Add table
Reference in a new issue