1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-30 16:17:46 +00:00

Changed timestamp(seconds) getter to use std::time internally, should get rid of the DC problem

This commit is contained in:
Mordred 2018-02-01 00:16:47 +01:00
parent 31d94f95a9
commit 575a3f61a9
2 changed files with 6 additions and 5 deletions

View file

@ -62,7 +62,7 @@ std::string Core::Util::binaryToHexDump( uint8_t* pBinData, uint16_t size )
uint8_t by = pBinData[i + j]; uint8_t by = pBinData[i + j];
line[hexColumn] = hexChars[( by >> 4 ) & 0xF]; line[hexColumn] = hexChars[( by >> 4 ) & 0xF];
line[hexColumn + 1] = hexChars[by & 0xF]; line[hexColumn + 1] = hexChars[by & 0xF];
line[charColumn] = by < 32 ? '.' : static_cast<char>( by ); line[charColumn] = by < 32 ? '.' : static_cast< char >( by );
} }
hexColumn += 3; hexColumn += 3;
@ -78,13 +78,14 @@ std::string Core::Util::binaryToHexDump( uint8_t* pBinData, uint16_t size )
uint64_t Core::Util::getTimeMs() uint64_t Core::Util::getTimeMs()
{ {
std::chrono::milliseconds epoch = std::chrono::duration_cast< std::chrono::milliseconds >(std::chrono::system_clock::now().time_since_epoch()); std::chrono::milliseconds epoch = std::chrono::duration_cast< std::chrono::milliseconds >
( std::chrono::system_clock::now().time_since_epoch() );
return epoch.count(); return epoch.count();
} }
uint64_t Core::Util::getTimeSeconds() int64_t Core::Util::getTimeSeconds()
{ {
std::chrono::seconds epoch = std::chrono::duration_cast< std::chrono::seconds >(std::chrono::system_clock::now().time_since_epoch()); std::chrono::seconds epoch = std::chrono::seconds( std::time( nullptr ) );
return epoch.count(); return epoch.count();
} }

View file

@ -13,7 +13,7 @@ std::string binaryToHexDump( uint8_t* pBinData, uint16_t size );
uint64_t getTimeMs(); uint64_t getTimeMs();
uint64_t getTimeSeconds(); int64_t getTimeSeconds();
uint64_t getEorzeanTimeStamp(); uint64_t getEorzeanTimeStamp();