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 Comparisons

Time Comparisons

Scheduled Pinned Locked Moved C / C++ / MFC
questionwindows-admin
4 Posts 3 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.
  • P Offline
    P Offline
    PaulJ
    wrote on last edited by
    #1

    How do I compare times using CTime. When I retreive a CTime value from the registry and compare it to the current time (using CTime::GetCurrentTime(), it also compares the dates which are several days apart. I need to compare the time part. Is there a way to mask out the date part then check if the current time is > or < the time saved in the registry?:confused: :confused: Paul Jahans

    C M 2 Replies Last reply
    0
    • P PaulJ

      How do I compare times using CTime. When I retreive a CTime value from the registry and compare it to the current time (using CTime::GetCurrentTime(), it also compares the dates which are several days apart. I need to compare the time part. Is there a way to mask out the date part then check if the current time is > or < the time saved in the registry?:confused: :confused: Paul Jahans

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      you could create two new CTime objects like this:

      CTime t1(1900,1,1,inTime1.GetHour(), inTime1.GetMin(), inTime1.GetSecond());
      CTime t2(1900,1,1,inTime2.GetHour(), inTime2.GetMin(), inTime2.GetSecond());

      then compare t1 and t2. (there might be a better way, tho) -c


      Garbage collection, making life better - for weenies!

      Image Processing - just like mom used to make.

      P 1 Reply Last reply
      0
      • P PaulJ

        How do I compare times using CTime. When I retreive a CTime value from the registry and compare it to the current time (using CTime::GetCurrentTime(), it also compares the dates which are several days apart. I need to compare the time part. Is there a way to mask out the date part then check if the current time is > or < the time saved in the registry?:confused: :confused: Paul Jahans

        M Offline
        M Offline
        Maximilien
        wrote on last edited by
        #3

        look at CTimeSpan, it might help you Max

        1 Reply Last reply
        0
        • C Chris Losinger

          you could create two new CTime objects like this:

          CTime t1(1900,1,1,inTime1.GetHour(), inTime1.GetMin(), inTime1.GetSecond());
          CTime t2(1900,1,1,inTime2.GetHour(), inTime2.GetMin(), inTime2.GetSecond());

          then compare t1 and t2. (there might be a better way, tho) -c


          Garbage collection, making life better - for weenies!

          Image Processing - just like mom used to make.

          P Offline
          P Offline
          PaulJ
          wrote on last edited by
          #4

          This is very simple. I'll use this for now unless I find a more common way. Thanks for you help Chris.:-D Paul Jahans

          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