WTBug? Effin time, how does it work!?


  • Garbage Person

    We have a home-rolled scheduler. Yeah, that's weird, but it does a lot of stuff that you can't get in off the shelf schedulers without extensive modifications anyway, so I'm not too bothered by its existence.

    Until someone put 12:00PM in as a run time for one particular type of schedule. We serialize that to the database as a timespan after local server midnight - so 12:00AM becomes 0:00. Noon becomes 12:00, 1PM becomes 13:00

    The 12:00PM (Local midnight+12 hours in the database) schedule ran at 12:00AM. 11:59 OK. 12:01 OK.
    12:00PM flips 12 hours out of phase.


  • FoxDev

    I don't get it......

    where did the + 12 hours in the database come from?

    12PM is noon, so the fact that it is stored in the database as 12 hours is not surprising.....

    what am I missing that makes this post make sense?



  • @accalia said:

    what am I missing that makes this post make sense?

    The job stored as 12 in the database ran at local midnight, while jobs at 11.59 and 12:01 ran around noon.



  • My head hurts. Why can't you use 00:00-23:59 time, like normal people?



  • I think he's trying to, but the system is treating 12:00 as 00:00.


  • FoxDev

    @cartman82 said:

    My head hurts. Why can't you use 00:00-23:59 time, like normal people?

    QFT.

    i switched to 24 hour clock time years ago and it has simplified my life immeasurably.

    I'd love to switch to metric entirely but that would actually make life harder as the speed limit signs are only posted in MPH and my speedometer can display MPH or KPH but not both at the same time



  • @accalia said:

    I'd love to switch to metric entirely but that would actually make life harder as the speed limit signs are only posted in MPH and my speedometer can display MPH or KPH but not both at the same time

    You just need a cheat sheet. I had one taped to the handlebars of my first motorcycle which had a metric speedometer.


  • FoxDev

    well the estimation i use when i need to convert is take half and add it to get miles => km. (multiply by 1.5)

    it's lossy, but it does reasonably well for estimation for short trips and it's a lot easier to do in my head than the actual conversion.

    going the other way..... 🤷 that i can't do in my head easy.



  • @mott555 said:

    You just need a cheat sheet. I had one taped to the handlebars of my first motorcycle which had a metric speedometer.

    Meh. Buy yourself a 50cc, that way you never need to worry about speed limits! (because you can't beat them no matter how hard you try).


    Filed under: that actually probably saved my ass at least once



  • Those 49cc scooters were pretty popular among college students in my last city. I wish I'd got it on video, but one day we saw a scooter rolling down Main Street at about 15 mph, engine revved up to the limit, with three people on board.

    I tried a roommate's scooter once and hated it. The geometry is just all wrong, especially to anyone who already rides motorcycles.



  • @mott555 said:

    The geometry is just all wrong

    Eh, I liked mine; it was a old-as-fuck two-stroke though, none of those cheap plastic toys. And it had gears, dammit.

    Granted, you blew through three of four of them when doing 0-to-30kph, but it had gears, dammit.



  • Sounds like a motorcycle with a small engine, and not a scooter. At least in the U.S., scooter is defined as a two-wheeled vehicle with less than 50cc engine displacement and an automatic transmission. Most of the ones I've seen were made about as cheap as possible, I don't think they even had a transmission per se, just a single fixed ratio and a rather slushy torque converter set on top of a pair of pushmower wheels.


  • kills Dumbledore

    My understanding is that that's a moped. A scooter is any non geared bike, including maxi scooters that can go up to similar sizes as full geared bikes (e.g. Honda Silverwing)



  • My understanding of moped is that it would have pedals too so you can assist the engine.


  • ♿ (Parody)

    My understanding of moped is that it's what blakey did after playing video games and eating the shit out of tacos all day.



  • @boomzilla said:

    My understanding of moped is that it's what blakey did after playing video games and eating the shit out of tacos all day.

    Buuurrrrn! Nice one.



  • @Weng said:

    The 12:00PM (Local midnight+12 hours in the database) schedule ran at 12:00AM. 11:59 OK. 12:01 OK. 12:00PM flips 12 hours out of phase.

    So midnight plus zero hours and zero minutes equals noon? Do you have access to the code, how the hell does that happen?



  • Still not vexed, keep trying.


  • ♿ (Parody)

    @blakeyrat said:

    Still not vexed, keep trying.

    If I were trying to vex, it wouldn't have been a sub-mention. I probably would have thought of some more relevant examples, too.



  • Well you ain't gonna vex or rankle me, but if you keep trying you might make me miffed. Maybe.



  • @accalia said:

    going the other way..... 🤷 that i can't do in my head easy.

    Divide by five and multiple by three. So if you're going 400 kilometers, divided by 5 is 80, 80 times 3 is 240. So about 240 miles (actual number is just above 248).



  • Having 12pm be converted to midnight.

    That's not really a WTF so much as a common bug, unless we see the code behind it, and there's a real WTF.


  • FoxDev

    the in my head being the key.

    this is a lady that regularly lost points in calculus because once things got down to the algebra point a - 1 would sometimes morph into a + 1 or visa versa. and that was on paper with pencil!

    of course if i was solving that sort of problem for work i'd let the computer take over once i set the problem up (possibly after doing some of the harder calculus stuff by hand for the fun of it) so that wouldn't be a problem and i never lost points on the actual calculus parts.



  • Ahhh, yeah, not many people can do that. I'm used to breaking things down in my head, I'd see something large like X * 24, and I'd break it down to (X * 8) * 3, which would be easier to do in my head.


  • FoxDev

    @chubertdev said:

    (X * 8) * 3

    odd choice.... i would have tended to do 6*4 personally....


  • Garbage Person

    We're still trying to isolate it. The times are stored as .net TimeSpan and added to midnight (spot the bug in that sentence). We then simply wait until after the resultant datetime to execute.

    So there shouldn't be a bug here....



  • Depends on how easy X * 8 is, if it's too much, then (X * 6) * 4 would have to suffice.

    You basically have X * Y, and you try to break down Y into a * b, with the largest a that you can use to figure out X * a, but YMMV.



  • @Weng said:

    We're still trying to isolate it. The times are stored as .net TimeSpan and added to midnight (spot the bug in that sentence). We then simply wait until after the resultant datetime to execute.

    So there shouldn't be a bug here....

    Uhh....


  • ♿ (Parody)

    @accalia said:

    odd choice.... i would have tended to do 6*4 personally....

    Bah... (X * 10) * 2 + (X * 2) * 2


  • Garbage Person

    For some awful reason, TimeSpan is the correct class for offsets (I.e. things you add to DateTime objects). Which is what this is.


  • I survived the hour long Uno hand

    You might have dyscalculia. That's the exact scenario that prompted me to get tested :)


  • FoxDev

    @Yamikuronue said:

    You might have dyscalculia.

    nah... just crappy handwriting.

    i have no problem with the algebra maths. it's reading what i wrote down on the line above as i reduce that gets transcription errors sometimes.


  • I survived the hour long Uno hand

    I tested positive for an unspecific visual processing disorder, and it turns out my "crappy handwriting" is actually an utter failure of my brain to estimate how much space I have to write in and where my hand is in relation to the lines. Other symptoms: being "clumsy" (knocking things over because my brain has no idea where my body is in relation to things around me), being unable to rotate maps in my head and therefore getting lost often, failing utterly at drawing tasks. I'm looking to take a dyscalculia-specific test soon, the one I had was for dyslexia and thus couldn't comment much on other related disorders.



  • @Weng said:

    For some awful reason, TimeSpan is the correct class for offsets (I.e. things you add to DateTime objects). Which is what this is.

    I think I'm misunderstanding what the structure of this code is. You said that the times, not time deltas, are stored as a TimeSpan. If it's a time delta, what is t0?



  • @accalia said:

    nah... just crappy handwriting.

    i have no problem with the algebra maths. it's reading what i wrote down on the line above as i reduce that gets transcription errors sometimes.

    Must be really bad. I've broken my writing hand multiple times, and most people struggle with my handwriting, but I don't have those issues...


  • FoxDev

    i was tested for

    different things back in HS, and dyslexia/dyscalculia were among those things.

    when it was all said and done the verdict was:

    "You're a weird kid, but your brain is as healthy as anyone could hope. Want a lollipop for the road?"


  • FoxDev

    @chubertdev said:

    Must be really bad. I've broken my writing hand multiple times, and most people struggle with my handwriting, but I don't have those issues...

    it's legible most of the time. it's when i need to cram a page and a half of calculations into the three inches provided that things get rough.

    I could get more paper, sure, but i'd rather just finish the test and go home....


  • Garbage Person

    Date of code execution 0:00 is t0.



  • @Weng said:

    Date of code execution 0:00 is t0.

    I really want to see the code on this one.



  • @Yamikuronue said:

    being unable to rotate maps in my head and therefore getting lost often

    Tip: do as an orienteer does with a compass and physically rotating the map so that map north matches what your compass says. Bonus points if you have a good compass and magnetic declination markings on your map, so that you can have map true north pointing at true north, not magnetic north.

    I have the exact opposite problem -- I can't orienteer in the traditional fashion because I can't stop my brain from mentally rotating the map so that map north points compass north.


  • Java Dev

    I somehow cannot deal with rotated maps. Some games do it to their ingame map - I always turn it off because it gets me utterly disoriented.

    Not sure how that would work with real maps though. Probably not as much of a problem because the problem with rotating maps is I can't correlate with how it looked last time.


  • Garbage Person

    Datetime.Now.Date.Add(timespan)

    (.Date gets the date component as a DateTime with the time component set to 0:00)



  • @Weng said:

    Datetime.Now.Date.Add(timespan)

    (.Date gets the date component as a DateTime with the time component set to 0:00)

    Yeah, I understand that. I'm just wondering what the use-case for that style is.


  • Winner of the 2016 Presidential Election

    @accalia said:

    it's legible most of the time. it's when i need to cram a page and a half of calculations into the three inches provided that things get rough.

    I could get more paper, sure, but i'd rather just finish the test and go home....

    Heh, this is one of the reasons I can (and do) write pretty small, but still have it legible. To the point that one of my algebra teachers:

    • Held up my paper next to some other student's paper in front of the class,
    • Proceeded to make a point that was something like "writing small can be bad, because it looks like less work, even if it's more."

    The other student had written so large, and I so small, that they took about half a page for something I had done over just a few lines. Of course, this was some sort of writing assignment in math class, which gets into the WTF that is (was?) No Child Left Behind..


  • FoxDev

    ..... wait.... essays in MATH CLASS?!

    WTHF with extra holy!?!

    i am glad that i graduated before that bullshit made it too far and i am now weeping for those that have to live with it....

    literally, no joke.


  • Winner of the 2016 Presidential Election

    @accalia said:

    ..... wait.... essays in MATH CLASS?!

    WTHF with extra holy!?!

    i am glad that i graduated before that bullshit made it too far and i am now weeping for those that have to live with it....

    literally, no joke.

    Fortunately not essays (unless I've forgotten them - quite possible). It was just a quick paragraph or two of some sort - but I think every non-elective class was required to have some writing component like that, for NCLB reasons. OTOH that was in Florida, which as we all know is TRWTF.


  • FoxDev

    @Weng said:

    Datetime.Now.Date.Add(timespan)

    Datetime.Today.Add(timespan)

    you're welcome.

    (it won't fix your bug but it will deobfusccate your intention)



  • @accalia said:

    Datetime.Today.Add(timespan)

    you're welcome.

    (it won't fix your bug but it will deobfusccate your intention)

    The fact that DateTime.Now.Date is a DateTime messes me up when I switch back and forth between .NET and Python, because the similar action in Python is a Date



  • @mott555 said:

    torque converter

    On small engines like scooters it's usually a centrifugal clutch. They're lighter, cheaper, and require less maintenance. Additional advantage for those of us that hate slushboxes: They stay engaged until speed is reduced, so engine braking can be effective.



  • @Dreikin said:

    Fortunately not essays (unless I've forgotten them - quite possible). It was just a quick paragraph or two of some sort - but I think every non-elective class was required to have some writing component like that, for NCLB reasons. OTOH that was in Florida, which as we all know is TRWTF.

    I bet they were doing it wrong too. Proper proof skills are very valuable for those studying higher maths (even calculus benefits from this!), but those are generally not taught outside of the context of HS geometry until you get into math-major-only college coursework.

    @accalia said:

    ..... wait.... essays in MATH CLASS?!

    WTHF with extra holy!?!

    i am glad that i graduated before that bullshit made it too far and i am now weeping for those that have to live with it....

    literally, no joke.


    One of the courses I took as a Math major was "Mathematical Writing", and it was basically a "how to write proofs" course. THAT is what we need to be folding into the mathematics curriculum -- frequent and unavoidable contact with the single most fundamental tool of the mathematical thinker.


Log in to reply