mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Miscellaneous cleanups for HAL, wpilibc, and wpilibj JNI (#589)
* Static functions in the HAL implementation were placed in the hal namespace * "using namespace" declarations in HAL/cpp/Log.h and Timer.cpp were replaced with "using" declarations for std::chrono * An extra include was removed from AnalogGyro.cpp * InterruptableSensorBase's constructor was defaulted * Newlines were added to some wpilibc integration tests for grouping * A variable in HALUtil.h was renamed to follow the style guide Supersedes #586
This commit is contained in:
committed by
Peter Johnson
parent
5e19c1881f
commit
d682295ccd
@@ -100,26 +100,27 @@ inline std::string NowTime() {
|
||||
llvm::SmallString<128> buf;
|
||||
llvm::raw_svector_ostream oss(buf);
|
||||
|
||||
using namespace std::chrono;
|
||||
auto now = system_clock::now().time_since_epoch();
|
||||
using std::chrono::duration_cast;
|
||||
|
||||
auto now = std::chrono::system_clock::now().time_since_epoch();
|
||||
|
||||
// Hours
|
||||
auto count = duration_cast<hours>(now).count() % 24;
|
||||
auto count = duration_cast<std::chrono::hours>(now).count() % 24;
|
||||
if (count < 10) oss << "0";
|
||||
oss << count << ":";
|
||||
|
||||
// Minutes
|
||||
count = duration_cast<minutes>(now).count() % 60;
|
||||
count = duration_cast<std::chrono::minutes>(now).count() % 60;
|
||||
if (count < 10) oss << "0";
|
||||
oss << count << ":";
|
||||
|
||||
// Seconds
|
||||
count = duration_cast<seconds>(now).count() % 60;
|
||||
count = duration_cast<std::chrono::seconds>(now).count() % 60;
|
||||
if (count < 10) oss << "0";
|
||||
oss << count << ".";
|
||||
|
||||
// Milliseconds
|
||||
oss << duration_cast<milliseconds>(now).count() % 1000;
|
||||
oss << duration_cast<std::chrono::milliseconds>(now).count() % 1000;
|
||||
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user