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. The Weird and The Wonderful
  4. Invalid TimeZone. Please Move.

Invalid TimeZone. Please Move.

Scheduled Pinned Locked Moved The Weird and The Wonderful
announcement
10 Posts 8 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.
  • S Offline
    S Offline
    SoMad
    wrote on last edited by
    #1

    Almost 12 years ago (before I joined the company :) ), this little beauty almost made it into the release build of one of our applications:

    // We need a time zone
    CString strTimeZone;
    timeb timeptr;
    ftime(&timeptr);
    long TimeZone = (long)timeptr.timezone/(long)60;

    switch(TimeZone)
    {
    case 8:
    strTimeZone = "P";
    break;
    case 7:
    strTimeZone = "M";
    break;
    case 6:
    strTimeZone = "C";
    break;
    case 5:
    strTimeZone = "E";
    break;
    default:
    AfxMessageBox("Invalid TimeZone. Please Move.");
    }

    Soren Madsen

    OriginalGriffO Sander RosselS S R W 6 Replies Last reply
    0
    • S SoMad

      Almost 12 years ago (before I joined the company :) ), this little beauty almost made it into the release build of one of our applications:

      // We need a time zone
      CString strTimeZone;
      timeb timeptr;
      ftime(&timeptr);
      long TimeZone = (long)timeptr.timezone/(long)60;

      switch(TimeZone)
      {
      case 8:
      strTimeZone = "P";
      break;
      case 7:
      strTimeZone = "M";
      break;
      case 6:
      strTimeZone = "C";
      break;
      case 5:
      strTimeZone = "E";
      break;
      default:
      AfxMessageBox("Invalid TimeZone. Please Move.");
      }

      Soren Madsen

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      It's not a horror - at least he checked - but it's not that helpful an error message, I must admit. However, it does give advice on how to solve the problem which is a vast improvement on most MS error messages of 12 years ago! :laugh:

      Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      S 1 Reply Last reply
      0
      • S SoMad

        Almost 12 years ago (before I joined the company :) ), this little beauty almost made it into the release build of one of our applications:

        // We need a time zone
        CString strTimeZone;
        timeb timeptr;
        ftime(&timeptr);
        long TimeZone = (long)timeptr.timezone/(long)60;

        switch(TimeZone)
        {
        case 8:
        strTimeZone = "P";
        break;
        case 7:
        strTimeZone = "M";
        break;
        case 6:
        strTimeZone = "C";
        break;
        case 5:
        strTimeZone = "E";
        break;
        default:
        AfxMessageBox("Invalid TimeZone. Please Move.");
        }

        Soren Madsen

        Sander RosselS Offline
        Sander RosselS Offline
        Sander Rossel
        wrote on last edited by
        #3

        I think that serves people right for living in invalid timezones! I'm glad someone was finally willing to tell them ;p I'm pretty sure the programmer was thinking of timezones such as GMT+4,35 and GMT-27 :)

        It's an OO world.

        public class Naerling : Lazy<Person>{
        public void DoWork(){ throw new NotImplementedException(); }
        }

        S 1 Reply Last reply
        0
        • Sander RosselS Sander Rossel

          I think that serves people right for living in invalid timezones! I'm glad someone was finally willing to tell them ;p I'm pretty sure the programmer was thinking of timezones such as GMT+4,35 and GMT-27 :)

          It's an OO world.

          public class Naerling : Lazy<Person>{
          public void DoWork(){ throw new NotImplementedException(); }
          }

          S Offline
          S Offline
          SoMad
          wrote on last edited by
          #4

          I wanted to share this, so I actually went to find it in our old SourceSafe database. I deleted a few lines of code that really did nothing, so what you see is what it did. Today in its place, the code formats a date/time with abbreviated time zone and Daylight saving information - getting the TZ abbreviation right is still a hit and miss (when TZ is outside the US), but at least you don't have to move :) Soren Madsen

          J 1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            It's not a horror - at least he checked - but it's not that helpful an error message, I must admit. However, it does give advice on how to solve the problem which is a vast improvement on most MS error messages of 12 years ago! :laugh:

            Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

            S Offline
            S Offline
            SoMad
            wrote on last edited by
            #5

            You are a true the-glass-is-half-full guy :laugh: Soren Madsen

            1 Reply Last reply
            0
            • S SoMad

              Almost 12 years ago (before I joined the company :) ), this little beauty almost made it into the release build of one of our applications:

              // We need a time zone
              CString strTimeZone;
              timeb timeptr;
              ftime(&timeptr);
              long TimeZone = (long)timeptr.timezone/(long)60;

              switch(TimeZone)
              {
              case 8:
              strTimeZone = "P";
              break;
              case 7:
              strTimeZone = "M";
              break;
              case 6:
              strTimeZone = "C";
              break;
              case 5:
              strTimeZone = "E";
              break;
              default:
              AfxMessageBox("Invalid TimeZone. Please Move.");
              }

              Soren Madsen

              S Offline
              S Offline
              satovey
              wrote on last edited by
              #6

              I recall seeing an error message something like that a while back. I thought it was rather stupid, given the fact that I had just clicked on an item in a drop down list. I think someone was trying to be funny. ST

              1 Reply Last reply
              0
              • S SoMad

                Almost 12 years ago (before I joined the company :) ), this little beauty almost made it into the release build of one of our applications:

                // We need a time zone
                CString strTimeZone;
                timeb timeptr;
                ftime(&timeptr);
                long TimeZone = (long)timeptr.timezone/(long)60;

                switch(TimeZone)
                {
                case 8:
                strTimeZone = "P";
                break;
                case 7:
                strTimeZone = "M";
                break;
                case 6:
                strTimeZone = "C";
                break;
                case 5:
                strTimeZone = "E";
                break;
                default:
                AfxMessageBox("Invalid TimeZone. Please Move.");
                }

                Soren Madsen

                R Offline
                R Offline
                RafagaX
                wrote on last edited by
                #7

                Well i suppose it wasn't meant to be used outside North America, so it may help avoid the use of illegal copies of that program on China. :laugh:

                CEO at: - Rafaga Systems - Para Facturas - Modern Components for the moment...

                1 Reply Last reply
                0
                • S SoMad

                  Almost 12 years ago (before I joined the company :) ), this little beauty almost made it into the release build of one of our applications:

                  // We need a time zone
                  CString strTimeZone;
                  timeb timeptr;
                  ftime(&timeptr);
                  long TimeZone = (long)timeptr.timezone/(long)60;

                  switch(TimeZone)
                  {
                  case 8:
                  strTimeZone = "P";
                  break;
                  case 7:
                  strTimeZone = "M";
                  break;
                  case 6:
                  strTimeZone = "C";
                  break;
                  case 5:
                  strTimeZone = "E";
                  break;
                  default:
                  AfxMessageBox("Invalid TimeZone. Please Move.");
                  }

                  Soren Madsen

                  W Offline
                  W Offline
                  wizardzz
                  wrote on last edited by
                  #8

                  Well, he accounted for EST, not EDT, so I assume for most of the year he got an error for east coast users.

                  1 Reply Last reply
                  0
                  • S SoMad

                    I wanted to share this, so I actually went to find it in our old SourceSafe database. I deleted a few lines of code that really did nothing, so what you see is what it did. Today in its place, the code formats a date/time with abbreviated time zone and Daylight saving information - getting the TZ abbreviation right is still a hit and miss (when TZ is outside the US), but at least you don't have to move :) Soren Madsen

                    J Offline
                    J Offline
                    jschell
                    wrote on last edited by
                    #9

                    SoMad wrote:

                    getting the TZ abbreviation right

                    You mean something like "MST"? Simple solution then - there is no deterministic way to solve this because there are time zone abbreviations that are the same for different zones. Best one can do is to - Use a numeric offset - Require an environment configuration that matches that offset.

                    1 Reply Last reply
                    0
                    • S SoMad

                      Almost 12 years ago (before I joined the company :) ), this little beauty almost made it into the release build of one of our applications:

                      // We need a time zone
                      CString strTimeZone;
                      timeb timeptr;
                      ftime(&timeptr);
                      long TimeZone = (long)timeptr.timezone/(long)60;

                      switch(TimeZone)
                      {
                      case 8:
                      strTimeZone = "P";
                      break;
                      case 7:
                      strTimeZone = "M";
                      break;
                      case 6:
                      strTimeZone = "C";
                      break;
                      case 5:
                      strTimeZone = "E";
                      break;
                      default:
                      AfxMessageBox("Invalid TimeZone. Please Move.");
                      }

                      Soren Madsen

                      J Offline
                      J Offline
                      JackDingler
                      wrote on last edited by
                      #10

                      If it builds, ship it.

                      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