News for hackers. Stuff that matters.
Re:Rival to SpaceX's Starlink Goes Dark After Failing to Acc... by cbxjksls on Saturday January 04, 2025 @11:48AM (#42595817)
rolling your own time library is as crazy as rolling your own crypto
Re:Rival to SpaceX's Starlink Goes Dark After Failing to Acc... by gruez on Saturday January 04, 2025 @12:26PM (#42596136)
To be fair most time libraries suck and can't handle fairly basic operations. For instance, if you're using python's datetime module and want to get the start/end dates of the current month, you need to "roll your own" like

    now = datetime.now()
    month_start = date(now.year, now.month, 1)
    month_end = date(now.year, now.month + 1, 1) - timedelta(days=1)
Re:Rival to SpaceX's Starlink Goes Dark After Failing to Acc... by brianwawok on Saturday January 04, 2025 @12:31PM (#42596172)
So in Dec your code hits month 13? Kinda funny in a post how rolling your own time library is easy we made trivial bugs
Re:Rival to SpaceX's Starlink Goes Dark After Failing to Acc... by gruez on Saturday January 04, 2025 @12:37PM (#42596244)
That's the point. I'm not advocating rolling your own date logic, only pointing out how easy it is to for "roll your own" logic to make its way into code even if if you're using a datetime library.
Re:Rival to SpaceX's Starlink Goes Dark After Failing to Acc... by ainiriand on Saturday January 04, 2025 @05:54PM (#42598284)
Your solution is faulty.
Re:Rival to SpaceX's Starlink Goes Dark After Failing to Acc... by compootr on Saturday January 04, 2025 @06:58PM (#42598593)
aren't months zero-indexed?
Re:Rival to SpaceX's Starlink Goes Dark After Failing to Acc... by MadnessASAP on Saturday January 04, 2025 @03:27PM (#42597450)
If you're going to copy my code onto HN I would appreciate attribution.

/s

Re:Rival to SpaceX's Starlink Goes Dark After Failing to Acc... by ainiriand on Saturday January 04, 2025 @05:52PM (#42598271)
You probably haven`t used phps Carbon.
Re:Rival to SpaceX's Starlink Goes Dark After Failing to Acc... by Caligatio on Sunday January 05, 2025 @12:01AM (#42599898)
You should use: calendar.monthrange
Re:Rival to SpaceX's Starlink Goes Dark After Failing to Acc... by orf on Sunday January 05, 2025 @11:14AM (#42602738)
First result on google for “python's datetime module and want to get the start/end dates of the current month” shows a simple solution:

https://stackoverflow.com/questions/42950/get-the-last-day-o...

Re:Rival to SpaceX's Starlink Goes Dark After Failing to Acc... by downrightmike on Saturday January 04, 2025 @06:37PM (#42598482)
Just use unix time directly
Re:Rival to SpaceX's Starlink Goes Dark After Failing to Acc... by nitwit005 on Sunday January 05, 2025 @12:20AM (#42599951)
The typical time libraries don't deal with satellites. Clocks are running at a slightly different rate in orbit.
Re:Rival to SpaceX's Starlink Goes Dark After Failing to Acc... by JPLeRouzic on Sunday January 05, 2025 @06:08AM (#42601015)
“The root cause was identified as a software issue within the ground segment”
Re:Rival to SpaceX's Starlink Goes Dark After Failing to Acc... by nitwit005 on Sunday January 05, 2025 @08:35AM (#42601654)
Yes, a thing that interacts with satellites, where you would expect that code to be.