[-] t_veor@sopuli.xyz 1 points 7 months ago

I'm quite confused as to how you're actually proposing the time should work. I assume that when we talk about abolishing timezones, we mean that everyone switches to a single standard timezone (and that it still goes from 00:00 - 23:59). Are you saying that you would like:

a) The date-rollover point to happen at local solar midnight (i.e. 12 hours past when the sun is highest in the sky in your location, or roughly that), regardless of what the time actually is
b) The date-rollover point to happen at 00:00 standard time, but most people still wake up and go to sleep roughly around when the sun rises and sets
c) The date-rollover point to happen at 00:00 standard time, but most people wake up at roughly 07:00 (for the sake of argument, it could just be any standard time) and go to sleep roughly 22:00, regardless of where the sun is at those times
d) Some other scenario that I didn't think of?

Maybe I suck at reading comprehension but I can't tell which system you're advocating for. I'm also confused when you give the example "15:00 on the 7th literally isn’t a time that can exist", because however your system works, surely if 15:00 on the 8th is a time that you can refer to, then 15:00 on the 7th is just the time 24 hours before that? (I'm actually just very confused by your scenario. Are you referring to noon as the local solar noon, i.e. when the sun is highest in the sky, or are you referring to when the clock reads 12:00? In both cases I can't figure out a way to make "15:00 on the 7th" impossible.)

Also I don't think that the sunrise/sunset times being different throughout the year or that DST exists are indications that the solar cycle is independent of the date. Even if the sunrise/sunset happens at different times of the year, timezones are clearly meant to roughly center the waking day either side of 12:00 on the clock around the solar noon. DST exists to make sure that people get more sun during the afternoon when people are more active, so that both contribute to that the date-rollover point happens when it's dark out and people are less active.

[-] t_veor@sopuli.xyz 2 points 7 months ago

Yeah, I'm in agreement that DST is kinda pointless and could probably be abolished, but the thread is about abolishing timezones in general (or so I thought).

Abolishing DST doesn't eliminate all the weird issues with "ephemeral" offsets though. Suppose the user wants to set a reminder for a recurring event at 3pm, and then moves to another country. Do you keep reminding them at 3pm in the new time zone or the old time zone? Maybe the reminder was "walk the dog" and the user meant for it to be at 3pm local time, or maybe it was "attend international meeting" and the user meant it to be at 3pm in the original timezone. (This admittedly only happens to calendar apps so isn't something that most applications have to deal with, unlike displaying timestamps in general.)

But other than that, I'm of the opinion that as programmers we're supposed to model the problem space as best we can and write software that fits the problem, rather than change the problem to fit our existing solution. After all, software is written to be used by humans, not the other way round (at least not yet). So if DST is something those wacky humans want and use, then a correct program is one which handles them correctly, and a programmers job is to deal with the complexity.

[-] t_veor@sopuli.xyz 5 points 7 months ago

I know I'm probably not changing your mind on this but interested in how you would want the system to be? Regarding your point about being able to rotate the clock so it matches the local solar cycle, suppose we're in a place where we have 13, at the top of the clock, because that's when midnight is where we are.

And let's say it's Wednesday 3rd April today. What happens when the clock reaches 13? After 1 second elapses, does your local clock go from Wednesday 3rd April 12:59:59 to...

a) Wednesday 3rd April 13:00:00 b) Thursday 4th April 13:00:00

If a) then you have the problem that the date change is now in the middle of the day, and most of the time you can't even say "what day is it today". (If 13:00 is midnight, then 00:00, when the date would roll over, would be just before noon.) You have to say today is "Wednesday/Thursday, or "3rd/4th April" because when you wake up it's Wednesday, but after lunch it becomes Thursday.

If b) then you have the problem where it may be Thursday 4th April 13:00:00 where you live, but actually it's not midnight yet somewhere else and so simultaneously it's Wednesday 3rd April 13:00:00 there. And in fact every location has their own time at which the date rolls over and it's not even possible to interpret a timestamp unless you have a table that tells you when midnight is for each location.

Maybe you feel that one or both of these are not really big enough of a problem, or maybe you can think of some other way of dealing with this that I haven't thought of. And yeah, both of these issues sort of happen already with timezones -- the issue in a) happens if you stay up past midnight, but at least it always happens at midnight at not when most people are awake and doing their business. The issue in b) sort of happens already since it can be Wednesday in one place and Thursday in another, but at least the timestamp would always indicate how many hours past the date rollover it is.

[-] t_veor@sopuli.xyz 4 points 7 months ago

Yeah, the article is written like it's parodying those who want to abolish timezones, but I'd be interested in specifically what you found unconvincing? I read the main point as being that time zones are an arbitrary social convention but that that arbitrary social conventions are pretty useful for humans.

Like one thing that the article does is repeatedly asking the question "but what time is it in Melbourne?" which I guess sounds pretty silly if you think timezones are unnecessary, since the question would be meaningless if timezones were abolished, and people in different parts of the world would already have centered their day around their respective parts of the clock and you would just look up what the times for everything are in another place. But I think the author was kind of already discarding that idea, because it's just equivalent to timezones - you have a lookup table for each part of the world to find out what people do at a certain time, except instead of being a single offset you have like a list of times like "school openings", "typical work hours", "typical waking hours" (?) etc. This system is basically timezones but harder to use for humans. So the author asking "but what time is it in Melbourne?" is in the context of this table not actually existing, because if it did, then you haven't actually abolished time zones.

[-] t_veor@sopuli.xyz 11 points 9 months ago

It's sometimes called comma-leading style where you move all the special characters to the front of the line and it is exceedingly common in Haskell, possibly due to how Haskell treats significant whitespace. You've surely seen list definitions that look like this:

someList =
  [ 1
  , 2
  , 3
  ] 

or a data definition like this:

data Color
  = Red
  | Green
  | Blue
  | RGB Int Int Int
  deriving (Show, Eq)

or a list of module exports like this:

module Foo
  { bar
  , baz
  , quux
  } 

Or in a long function type declaration where the arrows are moved to the start of the line, or a record definition, etc. etc.

[-] t_veor@sopuli.xyz 1 points 9 months ago

It's possible they tried the British layout on their American ANSI keyboard, which is missing the extra key that ISO keyboards have (the one next to enter which the British layout uses for # and ~)?

I'm not actually sure how to press that key at all if you're using the British layout on an ANSI keyboard

[-] t_veor@sopuli.xyz 2 points 1 year ago

It's not that hard to check yourself. Running the following code on my machine, I get that the linear algebra algorithm is already faster than the naive algorithm at around n = 100 or so. I've written a more optimised version of the naive algorithm, which is beaten somewhere between n = 200 and n = 500.

Try running this Python code on your machine and see what you get:

import timeit

def fib_naive(n):
    a = 0
    b = 1
    while 0 < n:
        b = a + b
        a = b - a
        n = n - 1
    return a

def fib_naive_opt(n):
    a, b = 0, 1
    for _ in range(n):
        a, b = b + a, b
    return a

def matmul(a, b):
    return (
        (a[0][0] * b[0][0] + a[0][1] * b[1][0], a[0][0] * b[0][1] + a[0][1] * b[1][1]),
        (a[1][0] * b[0][0] + a[1][1] * b[1][0], a[1][0] * b[0][1] + a[1][1] * b[1][1]),
    )

def fib_linear_alg(n):
    z = ((1, 1), (1, 0))
    y = ((1, 0), (0, 1))
    while n > 0:
        if n % 2 == 1:
            y = matmul(y, z)
        z = matmul(z, z)
        n //= 2

    return y[0][0]

def time(func, n):
    times = timeit.Timer(lambda: func(n)).repeat(repeat=5, number=10000)
    return min(times)

for n in (50, 100, 200, 500, 1000):
    print("========")
    print(f"n = {n}")
    print(f"fib_naive:\t{time(fib_naive, n):.3g}")
    print(f"fib_naive_opt:\t{time(fib_naive_opt, n):.3g}")
    print(f"fib_linear_alg:\t{time(fib_linear_alg, n):.3g}")

Here's what it prints on my machine:

========
n = 50
fib_naive:      0.0296
fib_naive_opt:  0.0145
fib_linear_alg: 0.0701
========
n = 100
fib_naive:      0.0652
fib_naive_opt:  0.0263
fib_linear_alg: 0.0609
========
n = 200
fib_naive:      0.135
fib_naive_opt:  0.0507
fib_linear_alg: 0.0734
========
n = 500
fib_naive:      0.384
fib_naive_opt:  0.156
fib_linear_alg: 0.112
========
n = 1000
fib_naive:      0.9
fib_naive_opt:  0.347
fib_linear_alg: 0.152

t_veor

joined 1 year ago