Invalid TimeZone. Please Move.
-
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
-
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
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
-
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
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(); }
} -
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(); }
}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
-
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
-
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
-
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
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...
-
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
-
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
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.
-
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
If it builds, ship it.