• (disco)

    What's in a name? That which we call ReturnCurrentGMTTime By any other name would still be shit.

    Quoted from Francis Bacon.

    EDIT: @Remy, your "Easy Reader version" comment is showing, seems the editor garbled your comment tags.

  • (disco)

    Stewarts advertised "Human Teller Machines", which was NOT a cyberpunk horror of melded flesh and machine

    I bursted out laughing.

  • (disco)

    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).

  • (disco)

    Are we completely ignoring the fact that there is DateTime.UtcNow?! This whole method is entirely superfluous.

  • (disco)

    Well - since DST in 2015 ended in Denmark last sunday, it is in deed wrong.

  • (disco)

    Only two hard things in Computer Science:

    1. Name Things
    2. Cache Invalidation
    3. Count things
  • (disco) in reply to tdwtf

    Adding RegEx, and now you have four problems... Wait.

  • (disco)

    Our chief weapon is surprise, surprise and fear, fear and surprise...

  • (disco) in reply to PleegWat

    Ruthless efficiency (as proven with the string cacophony) and an almost fanatical developer! developer! developer! developer!

  • (disco) in reply to LB_

    Not to be confused with Penn and Teller machines.

  • (disco) in reply to cheong
  • (disco) in reply to cheong

    If you're having RegEx problems I feel bad for you, son I've got 99 problems but a RegEx ain't one

  • (disco) in reply to Jonathan_Harston
    Jonathan_Harston:
    GMT Time is an acceptable phrase

    No. It really isn't.

  • (disco) in reply to Jonathan_Harston

    Sometimes I just use Zulu. For some reason it pops up more easily than UTC.

  • (disco) in reply to mar77i

    Whoo HOO!

  • (disco)

    You see, there’s an old joke, “There are three hard problems in computer science: naming things and counting things.”

    The version I heard was, "There are only two hard problems in computer science: cache invalidation, naming things, and off-by-one errors."

  • (disco)

    TR :wtf: is Daylight Saving Time (which, by the way, is officially saving, singular, not savings @Remy).

  • (disco) in reply to tdwtf
    tdwtf:
    Only two hard things in Computer Science: 1. Name Things 2. Cache Invalidation 3. Count thingsAvoiding off by one errors

    FTFY

  • (disco) in reply to Protoman
  • (disco)

    Why do people do this:

    string result = string.Empty;
    

    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

  • (disco) in reply to antiquarian
    antiquarian:
    Since your blanket is more than a foot (I originally heard this with 1 metre, which makes more sense at this point) wide, simply rotate the cut off part 90° before sewing it back on.
  • (disco) in reply to urkerab
    urkerab:
    Since your blanket is more than a foot (I originally heard this with 1 metre, which makes more sense at this point) wide, simply rotate the cut off part 90° before sewing it back on.

    ... thay made a longer blanket, but i imagine that last meter or so would be hard to stay warm under....

  • (disco) in reply to Protoman

    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 :(

  • (disco) in reply to caffiend
    caffiend:
    outlook

    Outlook or Exchange? (Not that I really care which.)

  • (disco) in reply to dkf
    dkf:
    Outlook or Exchange? (Not that I really care which.)

    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 :(

  • (disco) in reply to caffiend
    caffiend:
    Instead, we create one day where 2:30am never occurs and another day where it occurs twice.

    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.

  • (disco)

    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#)

  • (disco) in reply to Jaime
    Jaime:
    caffiend:
    Instead, we create one day where 2:30am never occurs and another day where it occurs twice.

    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.

    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.

  • (disco) in reply to Yazeran
    Yazeran:
    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#)

    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.

  • (disco) in reply to caffiend

    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.

  • (disco) in reply to anonymous234
    anonymous234:
    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.

    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.

  • (disco) in reply to Yazeran
    Yazeran:
    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#)

    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.

  • (disco) in reply to caffiend
    caffiend:
    Seriously, the java Date API is a complete joke

    which is why Java developers should use JodaTime instead of anything in the standard library.

  • (disco) in reply to caffiend

    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 ?!?

  • (disco) in reply to Yazeran

    This is why allowing subclassing of string would be a Bad Idea.

  • (disco) in reply to Yazeran
    Yazeran:
    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 ?!?

    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.

  • (disco) in reply to caffiend

    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???

  • (disco) in reply to Yazeran

    Correct; and this independently of what the actual time zone is.

  • (disco) in reply to Yazeran
    Yazeran:
    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???

    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.

  • (disco) in reply to Jaime

    We get it with both sunrise and sunset. Twice. And the changeover happens mere days after the first disaster ends.

  • (disco) in reply to tdwtf

    Only two hard things in Computer Science:

    1. Name Things Para
    2. Cache Invalidation lleliz
    3. Count things ation
  • (disco) in reply to caffiend
    caffiend:
    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.

    at least in your country it's the same every year. here:

    For each period, the executive branch of the government set the specific start and end dates for DST, i.e. there was no fixed annual schedule.

    fun times indeed

  • (disco) in reply to caffiend

    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)....

  • (disco) in reply to Jarry
    Jarry:
    [here][1]:

    FTFY. Somehow you and/or Discourse Belgium­ed your link.

  • (disco) in reply to Weng
    Weng:
    We get it with both sunrise and sunset. Twice. And the changeover happens mere days after the first disaster ends.

    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.

  • (disco) in reply to HardwareGeek

    Thanks. i blame the lack of coffee in the office

  • (disco)

    Joke implemented in Go :smile:

    http://play.golang.org/p/O6rLVybVGA

  • (disco)

    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).

  • (disco) in reply to dkf
    dkf:
    Why do people do this: ```c# string result = string.Empty; ``` 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_…

    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.

  • (disco) in reply to herby

    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.

Leave a comment on “The Hard Problem”

Log In or post as a guest

Replying to comment #:

« Return to Article