There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

Zagorath ,
@Zagorath@aussie.zone avatar

Dates and times aren’t that hard—honestly!

Video is a lecture about how to think about dates and times, through the lens of a specific open source .NET library designed to aid with applying that thinking. It points out how most languages’ standard libraries really work against you, because they conflate different concepts. For example, an Instant (a specific point in time, globally recognised) and a LocalDateTime (a date and time in a way that is irrespective of your location—for example you might want your alarm to wake you at 8:00 am on weekdays, and still do that if you move to a different time zone), a ZonedDateTime (a date and time tied to a specific location—like if you want to say “the meeting starts at 10:00 am Oslo Time”), and an OffsetDateTime (a date and time tied to a specific UTC offset—which is not necessarily the same as a time zone, because “Oslo Time” is a time zone that doesn’t change, but its UTC offset might change if they go in or out of DST, or if a place decides to change, like how Samoa changed from UTC-11 to UTC+13 in 2011.

These are all subtly different concepts which are useful in different cases, but most libraries force you to use a single poorly-defined “DateTime” class. It’s easier and requires less thought, but is also much more likely to get you into trouble as a result, precisely because of that lack of thought, because it doesn’t let you make a clear distinction about what specifically it is.

His library is great for this, but it’s very worth thinking about what he’s talking about even if you don’t or can’t use it. As he says in wrapping up:

You may be stuck using poor frameworks, but you don’t have to be stuck using poor concepts. You can think of the bigger concepts and represent all the bits without having to write your own framework, without having to do all kinds of stuff, just be really, really clear in all your comments and documentation.

ChaoticEntropy ,
@ChaoticEntropy@feddit.uk avatar

The notifications in one of our systems is aligned with UTC because it needs to be for a whole bunch of background services to function. Periodically (every couple of years) someone raises a ticket to complain that the time of their notifications is an hour out, and the 2nd line support worker will think “well that’s easy, I’ll just change the server time to BST”. This then brings this whole suite of applications to a crashing halt as everything fails.

cyborganism ,

Holy shit! Yes!!! Having worked with time sensitive data, it’s such bullshit.

gravitas_deficiency ,

Worst is when someone fucked up the DB time configs at some point and you have datetimes in a column that fall during the “nonexistent” hour in which clocks skip ahead for DST, and you have to figure out what the fuck actually happened there, and where in the data pipeline tz data was either added or stripped (sometimes it’s both, and sometimes it’s not just once), and undo the timestamp fuckery.

Source: did that this week. Was not super awesome.

alexc ,

I don’t know what the hate is unless you are trying to store time as a String property. There a special place in hell for all developers who do this.

IMHO, all you really need to know is an Epoch time stamp and whether it’s localized to the viewer or the creator… Not that complex. The problem with time zones is that politicians keep changing them

Honestly, I’d rather give the creator of NULL a slap.

dohpaz42 ,
@dohpaz42@lemmy.world avatar

I’m probably going to get a lot of hate for this, and I do recognize there have been problems with it all over the place (my code too), but I like null. I don’t like how it fucks everything up. But from a data standpoint, how else are you going to treat uninitialized data, or data with no value? Some people might initialize an empty string, but to me that’s a valid value in some cases. Same for using -1 or zero for numbers. There are cases where those values are valid. It’s like using 1 for true, and zero for false.

Whomever came up with the null coalescing operator (??) and optional chaining (?->) are making strides with handling null more elegantly.

I’m more curious why JavaScript has both null and undefined, and of course NaN. Now THAT is fucked up. Make it make sense.

pivot_root ,

To offer a differing opinion, why is null helpful at all?

If you have data that may be empty, it’s better to explicitly represent that possibility with an Optional<T> generic type. This makes the API more clear, and if implicit null isn’t allowed by the language, prevents someone from passing null where a value is expected.

Or if it’s uninitialized, the data can be stored as Partial<T>, where all the fields are Optional<U>. If the type system was nominal, it would ensure that the uninitialized or partially-initialized type can’t be accidentally used where T is expected since Partial<T> != T. When the object is finally ready, have a function to convert it from Partial<T> into T.

dohpaz42 ,
@dohpaz42@lemmy.world avatar

Ignoring the fact that a lot of languages, and database systems, do not support generics (but do already support null), you’ve just introduced a more complex type of null value; you’re simply slapping some lipstick on it. 😊

pivot_root ,

Type-safe lipstick :)

davidagain ,

In a discussion about whether null should exist at all, and what might be better, saying that Optional values aren’t available in languages with type systems that haven’t moved on since the 1960s isn’t a strong point in my view.

The key point is that if your type system genuinely knows reliably whether something has a value or not, then your compiler can prevent every single runtime null exception from occurring by making sure it’s handled at some stage and tracking it for you until it is.

The problem with null is that it is pervasive - any value can be null, and you can check for it and handle it, but other parts of your code can’t tell whether that value can or can’t be null. Tracking potential nulls is in the memory of the programmer instead of deduced by the compiler, and checking for nulls everywhere is tedious and slow, so no one does that. Hence null bugs are everywhere.

Tony Hoare, an otherwise brilliant computer scientist, called it his billion dollar mistake a decade or two ago.

coffeejoe ,

What’s wrong with NULL? How else can you differentiate between not having a value and having a blank value?

davidagain ,

The problem isn’t having empty values, it’s not tracking that in the type system, so the programmer and the compiler don’t have any information about whether a value can be null or not and the programmer has to figure it out by hand. In a complex program that’s essentially completely impossible. The innocently created bomb that causes your program to crash can be in absolutely any value.

There are ways to track it all by disallowing null and using optional values instead, but some folks would rather stick with type systems that haven’t moved on since the 1960s.

nothacking ,

Na let’s keep timezones, there useful for humans who generally want time to mean something, but lets ditch daylight savings time, all it does is make scheduling a massive pain twice a year, and messes up everyone’s sleep cycle. Without it, timezones would just be a fixed offset from another, minimizing trouble.

uis ,

Worst is UTC vs IAT

MystikIncarnate ,

IMO, the biggest problem with timezones is that the people who initially created them were fairly short sighted.

That and there have been way too many changes to who lives in what timezone. The one that boggles my mind is that apparently there’s a country in two timezones, not like, split down the middle or anything, but two active timezones across the entire country depending on which culture you’re a part of, or something. It’s wild.

I still don’t know if there’s any difference between GMT and UTC. I couldn’t find one. They both have the same time, same offset (+0), and represent the same time zone area.

I use UTC because I’m in tech, and I can’t stand time formats, so I exclusively use ISO 8601, with a 24 hour clock. Usually in my local time zone, via UTC. We have DST here which I’m not a fan of, but I have to abide by because everyone else does.

My biggest issues with time and timezones is that everyone uses different standards. It drives me nuts when software doesn’t let me set the standard for how the time and date is displayed, and doesn’t follow the system settings. It’s more common in web apps, but it happens a lot. I put in a lot of effort to try to get everything displaying in a standard format then some crudely written website is just mm/dd/yy with 12h clock and no timezone info, and there’s nothing you can do about it.

greysemanticist ,

I know people who actively fight me on ISO 8601. They don’t like the way it sorts their files/folders, reliant on whatever behavior the operating system does. Whenever data recovery happens or their files are moved, all the change times are blown out the window and the sorting they expect is blown away.

I’m not yet using a 24-hour clock. But it has me thinking. That’s not such a bad transition for 24-hour local time into UTC. Or just using both. At some point the inconvenience of the local will become vestigial and UTC is what remains.

Lightfire228 ,

I use 24h clocks and ISO 8601 dates almost always

Honestly, I’m better at organizing code than I am my actual life

davidagain ,

UTC exists as a historical compromise because the British felt that GMT was the bees knees and the French felt differently. The letter order is most definitely a compromise between French and English word order. You can call it Universal Time Coordinaire.

Historically, GMT became the international time reference point because the Greenwich observatory used to be the leader in the field of accurately measuring time. It probably helped that the British navy had been dominant earlier and lots of countries around the world and across time zones had been colonised by the British.

UTC is an international standard for measuring time, based on both satellite data about the position and orientation of the earth and atomic clocks, whereas GMT is a time zone. Nowadays, GMT is based on UTC not independent telescopic observation.

What’s the difference? You can think of a time zone as an offset from UTC, in the same sense that a 24h clock time is an offset from midnight. GMT = UTC+0.

Technically, UTC isn’t a valid time zone any more than “midnight” is a valid 24h clock time. UTC+0 is a time zone and UTC isn’t in a similar sense that 00:00 is a time in 24hr clock and “midnight” isn’t.

Of course, and perfectly naturally, I can use midnight and 00:00 interchangeably and everyone will understand, and I can use UTC and UTC+0 interchangeably and few people care, but GMT = UTC+0 feels like the +0 is doing nothing to most eyes.

Fun fact: satellite data is very accurate and can track the UTC meridian independently from the tectonic plate on which the Greenwich observatory stands. The UTC meridian will drift slowly across England as the plates shift. Also, the place in the stars that Greenwich was measuring was of by a bit, because they couldn’t have accounted for the effect of the terrain on the gravitational field, so the UTC meridian was placed several tens of metres (over 200’) away from the Greenwich prime meridian. I suspect that there was a lot more international politics than measurement in that decision, and also in making the technical distinction between UTC and GMT, but I’m British, so you should take that with a pinch of salt.

MystikIncarnate ,

That’s quite the lesson you just laid down.

It’s actually made things a lot more clear for me. To put it as tersely as I can, UTC is the international time, GMT is a timezone, which also happens to be UTC+0.

So GMT is a place/zone/region of earth, and UTC is a time coordination, with no physical location (beyond the prime meridian, which is where it is tracking the time of).

Awesome.

cupcakezealot ,
@cupcakezealot@lemmy.blahaj.zone avatar

stardate superiority

Sam_Bass ,

DST

numberfour002 ,

I would truthfully and happily go back in time and tell people not to waste with the fucked up bullshit technology of the past. I mean Angular 1, what the hell was that? Twitter integration? Fuck you 2010. Zend Framework? You should be hanged. HANGED.

Truck_kun ,

OMG, I’m dealing with a developer right now that is dealing with patient collected samples in several timezones, allowing the patients to either enter the time they collected, or use current time, and storing it in UTC time.

We do not receive any timezone data, patient collection data is showing different days than the patient could write on their samples depending on the time of day, and the developer said ‘just subtract X hours’ (our timezone)… for which not all patients would live in.

I suppose I could, if they’d provide the patient’s timezone, but they don’t even collect that. Can you just admit your solution is bad? It’s fine to store a timestamp in UTC, but not user provided data… don’t expect average users to calculate their time (and date) in UTC please.

MrScruff ,

Depends on what’s collecting the information. If it’s a website, then the client-side code could most certainly normalize everything to UTC based on the browsers time zone before submitting. That’s what I would probably do, if the user’s time zone isn’t needed or wanted…

SpaceCowboy ,
@SpaceCowboy@lemmy.ca avatar

This is actually the best approach.

Obviously they are getting timezone information otherwise the app could only display whatever time the user entered in.

If you want to sort things by the actual time, it’s simple and performant if all of the times are in the same timezone, and UTC would be the standard one to use. Pushing the timezone calculations to the client makes sense because the UTC time is correct, it’s just a matter of displaying it in a user friendly way, ie. show the time in the user’s timezone.

MTK ,

Is GMT and UTC not the same? I’m happy to not have to code for timezones

Pieresqi ,

I actually like DST

NocturnalMorning ,

No you don’t, stop telling lies.

Pieresqi ,

I do 👍

Zagorath ,
@Zagorath@aussie.zone avatar

A lot of things that people like are bad and should not be public policy.

Some individuals feeling like they like DST doesn’t counteract its significant health detriments.

snugglebutt ,
@snugglebutt@lemmy.blahaj.zone avatar

well that’s a domain

Zagorath ,
@Zagorath@aussie.zone avatar

Sorry, I don’t know what you mean.

snugglebutt ,
@snugglebutt@lemmy.blahaj.zone avatar

1000002112

Just kinda silly

Zagorath ,
@Zagorath@aussie.zone avatar

Oh, I see. Yeah I suppose it is, now that you point it out. It comes from:

  • .gov: the US government
  • .nih: the US National Institutes of Health
  • .nlm: the National Library of Medicine
  • .ncbi: the National Center for Biotechnology Information

But really, I only know it because it’s a very common host that comes up when you’re searching for published research papers. I just see “bunch of Ns .gov” and know it’s reliable.

SnotFlickerman ,
@SnotFlickerman@lemmy.blahaj.zone avatar
  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines