- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Quoted from Francis Bacon.
EDIT: @Remy, your "Easy Reader version" comment is showing, seems the editor garbled your comment tags.
Admin
I bursted out laughing.
Admin
GMT Time is an acceptable phrase, admittedly a bit clumsy if expanded. GMT is the adjective describing the time, it's the time in the GMT time zone. "The time is 4 o'clock GMT", "The time is 4 o'clock Greenwich Mean Time".
And for programming purposes you should be using UTC not GMT (even though GMT is defined as (almost) UTC).
Admin
Are we completely ignoring the fact that there is DateTime.UtcNow?! This whole method is entirely superfluous.
Admin
Well - since DST in 2015 ended in Denmark last sunday, it is in deed wrong.
Admin
Only two hard things in Computer Science:
Admin
Adding RegEx, and now you have four problems... Wait.
Admin
Our chief weapon is surprise, surprise and fear, fear and surprise...
Admin
Ruthless efficiency (as proven with the string cacophony) and an almost fanatical developer! developer! developer! developer!
Admin
Not to be confused with Penn and Teller machines.
Admin
Admin
If you're having RegEx problems I feel bad for you, son I've got 99 problems but a RegEx ain't one
Admin
No. It really isn't.
Admin
Sometimes I just use Zulu. For some reason it pops up more easily than UTC.
Admin
Whoo HOO!
Admin
The version I heard was, "There are only two hard problems in computer science: cache invalidation, naming things, and off-by-one errors."
Admin
TR :wtf: is Daylight Saving Time (which, by the way, is officially saving, singular, not savings @Remy).
Admin
FTFY
Admin
Admin
Why do people do this:
when they are going to assign the variable without using the value already within it? Yes, the compiler can clean it up, but it is still stupid…
Admin
Admin
... thay made a longer blanket, but i imagine that last meter or so would be hard to stay warm under....
Admin
If you're society is really so adamant about making the most of the summer sunshine, why not simply redefine working hours as being from 8 to 4 instead of 9 to 5. Instead, we create one day where 2:30am never occurs and another day where it occurs twice. Every year, no matter how much effort and forethought our team puts into handling this "correctly" (if there even is a correct way to handle it) some new corner-case crops up.
The only thing more annoying is that outlook "feature" where when you schedule a meeting with someone in another state at say 9:00am, it schedules it in your local time and automatically adjusts it for their local timezone. I've had this happen once where I scheduled a meeting in Perth at 9:00am, only to show up to find some really angry people who were initially quite pissed off that I scheduled a meeting for 6:00am, and even more so when I didn't show up until 9 :(
Admin
Outlook or Exchange? (Not that I really care which.)
Admin
Probably Exchange. I don't know. That shitty email client that work make you use which isn't lotus notes.
But seriously don't get me started on that. TRWTF is email. It's turned into a highly effective technology for allowing incompetent project managers to waste inordinate amounts of time by BCC bombing an entire dev team and having 14 people work on the same issue independently, then justify it by saying "I get an answer faster this way". Sorry don't want to derail your thread. but it's 2am and I'm still at work :(
Admin
Even worse, at my latitude, it creates two stretches of a few days where evening rush hour traffic is driving directly towards the setting sun, instead of just one. I'm positive that this kills hundreds every year.
Admin
Am I the only one having a problem with this:
string fs = "yyyy-MM-dd'T'HH:mm:ss"; result = time.ToString(fs); result += "+02:00";
As I read that, it takes a time object and convert it to a string (according the that formatting string) and the contcats '+02:00' to the end of that string, or is there some magic autoboxing/conversion in there I'm not familiar with (I've never worked with C#)
Admin
One of many legitimate issues with DST. But my answer wouldn't help you, you'd still have that issue if we moved working hours.
On the other hand, our politicians aren't so smart, the one state on the east coast of Australia which doesn't have DST does shuns it on the basis that it "fade's the curtains" and it "confuses the cows".
Doesn't change the fact that DST retarded. Shame that swatch "beat time" didn't catch on.
Admin
It's because DateTime.Parse() sees the timezone offset and treats it as an ISO 8601 date, and then can reverse the offset. Yes, it's stupid, and the whole function should be replaced with
DateTime.UTCNow
but that's why it has any effect at all.Admin
Or if you rally want to change the time, extend one day to have 25 hours and shorten another one to 23. Much better IMO than having a certain timestamp happen twice.
Admin
It's what effectively happens. But please don't popularize yet another representation of this insanity. If this catches on, Java will need to deprecate all their date processing classes (again) and it'll be even worse than the fact that Date.GetHour() is deprecated and instead you've gotta use all that Calendar.GetWhatever() nonsense (just in case you want to use the Julian Calendar in 2015). Or maybe they'll make a new class to replace LocalDate so we now have LocalDSTDate. Seriously, the java Date API is a complete joke. Makes C#'s date library seem well designed. Which it is (relatively speaking), except no frameworks support the DateTimeOffset object.
Admin
Close. It takes the current time, then converts it to a string and drops the Time Zone. Then, no matter what the original time zone was, it adds the time zone UTC+2 on the end.
In the original programmer's defense, "It works for me" applies as long as you're in Denmark and it's still summer. Otherwise, it's everything we've come to expect from years of government training at rolling your own date and time handling functions.
Admin
which is why Java developers should use JodaTime instead of anything in the standard library.
Admin
You mean to tell me that time.ToString() does not return a normal string object, but a special one which still knows that it was originally a time object (but still can be assigned to a string object maintaining it's special nature) WTF ?!?
Admin
This is why allowing subclassing of
string
would be a Bad Idea.Admin
No, I'm assuming that whoever calls this function is going to pass it's return value to DateTime.Parse() then use that to get the time minus the offset. The way that DateTime.Parse() works (which if anyone is interested, is a bloody slow operation because of all this) is that tries to deduce the format of the string either by eliminating impossible months (in the event that American date and normal date are exchanged by systems with incompatible locales), looking for something which can be parsed as an ISO 8601 date, or just about any other sort of divination it can use to turn a string into a date. So by adding the offset marker, it will be treated as an ISO date, and the DateTime object can remove the offset.
Admin
Ok, so my original issue that to days function returned a string like '2015-10-24 16:45:32+02:00' was actually correct or am I completely off???
Admin
Correct; and this independently of what the actual time zone is.
Admin
Yes, despite the fact that the function is wrong because it builds it using string concatenation, and a fixed offset which is only valid during DST months, it IS a valid ISO 8601 date.
This is what makes it special. DateTime.Parse knows it has a timezone offset now, where as before it didn't.
If this thread has any value it would be for this public service announcement.
Admin
We get it with both sunrise and sunset. Twice. And the changeover happens mere days after the first disaster ends.
Admin
Only two hard things in Computer Science:
Admin
at least in your country it's the same every year. here:
fun times indeed
Admin
Oh, I'm not in any way saying that it is not wrong, I just had a hart time looking at that string concatenation and comparing with the function name (which suggest that it returns a string with the current GMT. It does (in GMT+1 with DST or GMT+2 without DST areas) although in a strange way).
I was merely thinking that a function which returns something time related as a string would only ever be used in a GUI to be displayed to the user and in that context the '+02:00' part would stand out as a sore thumb (or should in any case)....
Admin
FTFY. Somehow you and/or Discourse Belgiumed your link.
Admin
You can blame the second autumn sunset on G.W. Bush. Without the extension of the October DST switch in 2007, you would have only had one.
Admin
Thanks. i blame the lack of coffee in the office
Admin
Joke implemented in Go :smile:
http://play.golang.org/p/O6rLVybVGA
Admin
Is it just me, or is my math really screwed up? If you are in Denmark (in the summer), you are two hours ahead of GMT. To get BACK to GMT, you need to SUBTRACT two hours, not ADD two hours, so the calculation is only applicable to Greenland in the summer (they went off DST last Saturday).
Yes, this is a little weird, but one shouldn't do time calculations willy-nilly, they need to be pretty solid.
Thankfully, my nice RadioShack clock that gets it information from NIST has this all figured out. As long as the guys at NIST set the bits correctly, it compensates wonderfully for DST and the switch on the back selects the USA time zone (Pacific time in my case).
Admin
Some people believe in initializing all their variables at the head of the procedure :smiley:
Though in this example I must assume it was accrued accidentally.
Admin
The
+02:00
isn't a calculation, it's a timezone offset. It's the number of hours and minutes you need to ADD to GMT to get local time.