This is currently how I am getting system time:
void Sum_AnalogClock::GetSystemTime()
{
std::time_t t = std::time(0); // get time now
std::tm* now = std::localtime(&t);
angleSeconds = now->tm_sec;
angleMinutes = now->tm_min;
angleHours = now->tm_hour;
if (angleHours > 12)
angleHours -= 12;
}
Do I need to delete now;?
No, according to [1] it points to an internal data structure, so you don't need to delete it.
[1] https://en.cppreference.com/w/cpp/chrono/c/localtime
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With