time woes
-
I have to work with time functions. Time and date values have to be stored in string representation and have to be in UTC. Format is yyyymmddhhmmss. Now I use time() to get the current time and gmtime() to break it down into single values for formatting. When converting the string back into a struct tm I cannot use mktime() because that function takes the time zone into account, i.e. the resulting time value is not the same as before. I know that localtime() and mktime() are counterparts, is there any counterpart for gmtime()?
Look! They have the Internet on computers now! (Homer J. Simpson)
-
I have to work with time functions. Time and date values have to be stored in string representation and have to be in UTC. Format is yyyymmddhhmmss. Now I use time() to get the current time and gmtime() to break it down into single values for formatting. When converting the string back into a struct tm I cannot use mktime() because that function takes the time zone into account, i.e. the resulting time value is not the same as before. I know that localtime() and mktime() are counterparts, is there any counterpart for gmtime()?
Look! They have the Internet on computers now! (Homer J. Simpson)
If you're using MFC, I would use
CTime
orCOleDateTime
instead. /ravi Let's put "civil" back in "civilization" http://www.ravib.com ravib@ravib.com -
If you're using MFC, I would use
CTime
orCOleDateTime
instead. /ravi Let's put "civil" back in "civilization" http://www.ravib.com ravib@ravib.com -
Unfortunately I have to use plain C/C++ for portability reasons...
Look! They have the Internet on computers now! (Homer J. Simpson)
I think you can use
_ftime()
to get the current timezone. /ravi Let's put "civil" back in "civilization" http://www.ravib.com ravib@ravib.com