C++ function that converts time(NULL) to local time -


in c++ i'm writing function converts time(null), seconds since january 1, 1970 in utc time, local time est in military time format (hours:minutes:seconds). i'm stumped how mathematically program stays accurate time moves forward.

also i'm aware there local time function i'd build function ground up. have advice or tips?

also i'm aware there local time function i'd build function ground up. have advice or tips?

why want when there plenty of free , well-tested packages? mentioned in comments, getting daylight savings time correct non-trivial. existing packages that, , right, based on iana tzinfo database.

c options:

  • std::localtime(). function uses global variable; not thread safe.

  • localtime_r(). posix function , not part of c++ library. not exist on windows.

  • localtime_s(). optional c11 function. if exists on machine, might not part of <ctime>.

c++ options:


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -