Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. time woes

time woes

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lakitu
    wrote on last edited by
    #1

    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)

    RaviBeeR 1 Reply Last reply
    0
    • L Lakitu

      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)

      RaviBeeR Offline
      RaviBeeR Offline
      RaviBee
      wrote on last edited by
      #2

      If you're using MFC, I would use CTime or COleDateTime instead. /ravi Let's put "civil" back in "civilization" http://www.ravib.com ravib@ravib.com

      L 1 Reply Last reply
      0
      • RaviBeeR RaviBee

        If you're using MFC, I would use CTime or COleDateTime instead. /ravi Let's put "civil" back in "civilization" http://www.ravib.com ravib@ravib.com

        L Offline
        L Offline
        Lakitu
        wrote on last edited by
        #3

        Unfortunately I have to use plain C/C++ for portability reasons...


        Look! They have the Internet on computers now! (Homer J. Simpson)

        RaviBeeR 1 Reply Last reply
        0
        • L Lakitu

          Unfortunately I have to use plain C/C++ for portability reasons...


          Look! They have the Internet on computers now! (Homer J. Simpson)

          RaviBeeR Offline
          RaviBeeR Offline
          RaviBee
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups