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. Other Discussions
  3. Clever Code
  4. CTime and DayLight saving

CTime and DayLight saving

Scheduled Pinned Locked Moved Clever Code
sysadmin
13 Posts 7 Posters 3 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
    logicaldna
    wrote on last edited by
    #1

    (not sure if this is well known) When you call CTime contructor to generate a time,the last parameter is day light saving flag, CTime( int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, int nDST = –1 ); if your machine has "Automatically adjust to daylight saving" flag True(Check box in Time Zone setting) then this last flag does not give you correct time lags behind by an hour, this was my headache as the server came out of Daylight saving period, (in October) to solve this i switched to COLEDateTime which does it correctly or rather neglects DL saving

    ------------------------------ Its not the fall that kills you; it's the sudden stop at the end.

    A R 2 Replies Last reply
    0
    • L logicaldna

      (not sure if this is well known) When you call CTime contructor to generate a time,the last parameter is day light saving flag, CTime( int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, int nDST = –1 ); if your machine has "Automatically adjust to daylight saving" flag True(Check box in Time Zone setting) then this last flag does not give you correct time lags behind by an hour, this was my headache as the server came out of Daylight saving period, (in October) to solve this i switched to COLEDateTime which does it correctly or rather neglects DL saving

      ------------------------------ Its not the fall that kills you; it's the sudden stop at the end.

      A Offline
      A Offline
      Antony M Kancidrowski
      wrote on last edited by
      #2

      I tend to always use UTC for internals and then display with the locale time settings. It prevents many problems.

      Ant. I'm hard, yet soft.
      I'm coloured, yet clear.
      I'm fruity and sweet.
      I'm jelly, what am I? Muse on it further, I shall return!
      - David Walliams (Little Britain)

      1 Reply Last reply
      0
      • L logicaldna

        (not sure if this is well known) When you call CTime contructor to generate a time,the last parameter is day light saving flag, CTime( int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, int nDST = –1 ); if your machine has "Automatically adjust to daylight saving" flag True(Check box in Time Zone setting) then this last flag does not give you correct time lags behind by an hour, this was my headache as the server came out of Daylight saving period, (in October) to solve this i switched to COLEDateTime which does it correctly or rather neglects DL saving

        ------------------------------ Its not the fall that kills you; it's the sudden stop at the end.

        R Offline
        R Offline
        Ryan Binns
        wrote on last edited by
        #3

        Yet another reason why daylight saving is evil... as if there aren't enough reasons already :mad:

        Ryan

        "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

        P S 2 Replies Last reply
        0
        • R Ryan Binns

          Yet another reason why daylight saving is evil... as if there aren't enough reasons already :mad:

          Ryan

          "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

          P Offline
          P Offline
          Paul Conrad
          wrote on last edited by
          #4

          Ryan Binns wrote:

          Yet another reason why daylight saving is evil... as if there aren't enough reasons already :mad:

          Yup. Don't get me started about it :rolleyes:


          If you try to write that in English, I might be able to understand more than a fraction of it. - Guffa

          1 Reply Last reply
          0
          • R Ryan Binns

            Yet another reason why daylight saving is evil... as if there aren't enough reasons already :mad:

            Ryan

            "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

            S Offline
            S Offline
            Stephen Hewitt
            wrote on last edited by
            #5

            Daylight savings kicks arse.

            Steve

            R 1 Reply Last reply
            0
            • S Stephen Hewitt

              Daylight savings kicks arse.

              Steve

              R Offline
              R Offline
              Ryan Binns
              wrote on last edited by
              #6

              Stephen Hewitt wrote:

              Daylight savings kicks arse.

              Why?

              Ryan

              "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

              S 1 Reply Last reply
              0
              • R Ryan Binns

                Stephen Hewitt wrote:

                Daylight savings kicks arse.

                Why?

                Ryan

                "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

                S Offline
                S Offline
                Stephen Hewitt
                wrote on last edited by
                #7

                Because when you get home from work there's still same daylight left.

                Steve

                R 1 Reply Last reply
                0
                • S Stephen Hewitt

                  Because when you get home from work there's still same daylight left.

                  Steve

                  R Offline
                  R Offline
                  Ryan Binns
                  wrote on last edited by
                  #8

                  Stephen Hewitt wrote:

                  Because when you get home from work there's still same daylight left.

                  Riiiight. So we have daylight saving in summer, when there are already more hours of daylight. Makes a lot of sense. Even without daylight saving, here it stays light until about 8:00pm, now it doesn't get dark until about 9:00pm. Makes it nice and easy for putting kids to bed - "But the sun's still up!". Yeah that makes things nice and easy. Here we have daylight saving over the hottest part of the year, so the hot evening drags on for longer. It stays hot until later at night, making it harder to sleep. On top of that, I'm now driving to work when it's dark instead of in daylight, and driving home before it starts to cool off. If I want to go for a jog or a walk after work, I now have to wait until about 8pm when it starts to cool down, pretty much breaking up the evening completely. At least when I used to go at 7pm, I still had most of the evening where I could go out or do other stuff. I could pretend to understand it if it's in winter, in a place where it's dark by maybe 4pm. But in summer? Where it's light until 8pm anyway? What utter rubbish. I can't comprehend the sheer lunacy that it takes to come up with the idea, or to support it.

                  Ryan

                  "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

                  S D R 3 Replies Last reply
                  0
                  • R Ryan Binns

                    Stephen Hewitt wrote:

                    Because when you get home from work there's still same daylight left.

                    Riiiight. So we have daylight saving in summer, when there are already more hours of daylight. Makes a lot of sense. Even without daylight saving, here it stays light until about 8:00pm, now it doesn't get dark until about 9:00pm. Makes it nice and easy for putting kids to bed - "But the sun's still up!". Yeah that makes things nice and easy. Here we have daylight saving over the hottest part of the year, so the hot evening drags on for longer. It stays hot until later at night, making it harder to sleep. On top of that, I'm now driving to work when it's dark instead of in daylight, and driving home before it starts to cool off. If I want to go for a jog or a walk after work, I now have to wait until about 8pm when it starts to cool down, pretty much breaking up the evening completely. At least when I used to go at 7pm, I still had most of the evening where I could go out or do other stuff. I could pretend to understand it if it's in winter, in a place where it's dark by maybe 4pm. But in summer? Where it's light until 8pm anyway? What utter rubbish. I can't comprehend the sheer lunacy that it takes to come up with the idea, or to support it.

                    Ryan

                    "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

                    S Offline
                    S Offline
                    Stephen Hewitt
                    wrote on last edited by
                    #9

                    Ryan Binns wrote:

                    So we have daylight saving in summer, when there are already more hours of daylight. Makes a lot of sense.

                    But in the winter I'm less inclined to do anything daylight or not.

                    Ryan Binns wrote:

                    Makes it nice and easy for putting kids to bed - "But the sun's still up!". Yeah that makes things nice and easy.

                    I remember having the same objection as a kid. Not having kids myself I don't have that problem.

                    Steve

                    R 1 Reply Last reply
                    0
                    • S Stephen Hewitt

                      Ryan Binns wrote:

                      So we have daylight saving in summer, when there are already more hours of daylight. Makes a lot of sense.

                      But in the winter I'm less inclined to do anything daylight or not.

                      Ryan Binns wrote:

                      Makes it nice and easy for putting kids to bed - "But the sun's still up!". Yeah that makes things nice and easy.

                      I remember having the same objection as a kid. Not having kids myself I don't have that problem.

                      Steve

                      R Offline
                      R Offline
                      Ryan Binns
                      wrote on last edited by
                      #10

                      Stephen Hewitt wrote:

                      But in the winter I'm less inclined to do anything daylight or not.

                      That's your prerogative. There's a big difference between being able to and being willing to.

                      Ryan

                      "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

                      S 1 Reply Last reply
                      0
                      • R Ryan Binns

                        Stephen Hewitt wrote:

                        But in the winter I'm less inclined to do anything daylight or not.

                        That's your prerogative. There's a big difference between being able to and being willing to.

                        Ryan

                        "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

                        S Offline
                        S Offline
                        Stephen Hewitt
                        wrote on last edited by
                        #11

                        True, but the warmth tends to make me more willing although no less able.

                        Steve

                        1 Reply Last reply
                        0
                        • R Ryan Binns

                          Stephen Hewitt wrote:

                          Because when you get home from work there's still same daylight left.

                          Riiiight. So we have daylight saving in summer, when there are already more hours of daylight. Makes a lot of sense. Even without daylight saving, here it stays light until about 8:00pm, now it doesn't get dark until about 9:00pm. Makes it nice and easy for putting kids to bed - "But the sun's still up!". Yeah that makes things nice and easy. Here we have daylight saving over the hottest part of the year, so the hot evening drags on for longer. It stays hot until later at night, making it harder to sleep. On top of that, I'm now driving to work when it's dark instead of in daylight, and driving home before it starts to cool off. If I want to go for a jog or a walk after work, I now have to wait until about 8pm when it starts to cool down, pretty much breaking up the evening completely. At least when I used to go at 7pm, I still had most of the evening where I could go out or do other stuff. I could pretend to understand it if it's in winter, in a place where it's dark by maybe 4pm. But in summer? Where it's light until 8pm anyway? What utter rubbish. I can't comprehend the sheer lunacy that it takes to come up with the idea, or to support it.

                          Ryan

                          "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

                          D Offline
                          D Offline
                          Dan Neely
                          wrote on last edited by
                          #12

                          Ryan Binns wrote:

                          I could pretend to understand it if it's in winter, in a place where it's dark by maybe 4pm. But in summer? Where it's light until 8pm anyway? What utter rubbish.

                          I've been arguing for double summertime in the winter for years without success. Apparently unlike those who live at higher lattitudes, mid lattitude kids are unable to wait for a schoolbus in the dark without getting killed. :rolleyes::rolleyes: EDIT: If you want to continue this discussion we really should move it to the lounge or soapbox.

                          -- Rules of thumb should not be taken for the whole hand.

                          1 Reply Last reply
                          0
                          • R Ryan Binns

                            Stephen Hewitt wrote:

                            Because when you get home from work there's still same daylight left.

                            Riiiight. So we have daylight saving in summer, when there are already more hours of daylight. Makes a lot of sense. Even without daylight saving, here it stays light until about 8:00pm, now it doesn't get dark until about 9:00pm. Makes it nice and easy for putting kids to bed - "But the sun's still up!". Yeah that makes things nice and easy. Here we have daylight saving over the hottest part of the year, so the hot evening drags on for longer. It stays hot until later at night, making it harder to sleep. On top of that, I'm now driving to work when it's dark instead of in daylight, and driving home before it starts to cool off. If I want to go for a jog or a walk after work, I now have to wait until about 8pm when it starts to cool down, pretty much breaking up the evening completely. At least when I used to go at 7pm, I still had most of the evening where I could go out or do other stuff. I could pretend to understand it if it's in winter, in a place where it's dark by maybe 4pm. But in summer? Where it's light until 8pm anyway? What utter rubbish. I can't comprehend the sheer lunacy that it takes to come up with the idea, or to support it.

                            Ryan

                            "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

                            R Offline
                            R Offline
                            ricecake
                            wrote on last edited by
                            #13

                            Ryan Binns wrote:

                            I can't comprehend the sheer lunacy that it takes to come up with the idea, or to support it.

                            The original idea was to save energy costs. http://webexhibits.org/daylightsaving/c.html[^]

                            -- Marcus Kwok

                            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