mysql - C++ store and retrieve UTC time with DST info to/from database -
i´m using c++ under linux , confess after reading many posts on theme i´m litte confused around time_t, struct tm, time, ctime , strftime.
what need current system date/time, convert utc , store in database. later on need retrieve date/time , print on screen in human readable format.
i´m using oracle (timestamp), mysql (datetime) , sqlite3 (has no datetime field, stored either on int or varchar()).
the important need store date/time current time zone considering dst time, when result can recover original time zone of dst correct information display.
something like:
// current time std::time_t = std::time(0); // convert oracle ??? ? oracletime = ?; // convert mysql ??? ? mysqltime = ?; // store on sqlite3 int sqlite3time = now; // print time std::cout << << std::endl; what correct conversion steps here ?
thanks helping.
Comments
Post a Comment