8 ms·
Compensate for Rockchip calendar deviation on November 31st (2015)
- Evidlo 5y agoFor anyone else confused by this, this is not a new calendar proposal. This is a fix for a bug in the RK808 real time clock (RTC) where November has 31 days.
- KineticLensman 5y agoAnd this is why, tempting as it is sometimes, you shouldn't use sarcasm in comments, commits, etc, that will be read by people who might not realise that you are joking. Not even subtle, well-crafted sarcasm. [Edit] Not sarcasm, but when I was a young programmer I worked with a colleague on a system that detected short circuits in analogue circuit boards. Many of the variables in our code used the names of short people (Ronnie, Corbett, etc). We thought this hilarious. Our boss didn't, and gave us a stern lecture on the possible maintenance / legal ramifications.
- bellyfullofbac 5y agoWow, I was wondering what the reasoning was that a calendar with 31 days in November would be be better aligned with the motions of the universe, but that patch didn't have it. Only this comment made me realize that they were being sarcastic. Yeah, not funny.
- st_goliath 5y ago> but that patch didn't have it Because the patch itself never made any such claim. It was the out-of-context headline here that implied it.
- karagenit 5y ago> Similarly, in A.D. 2013 Rockchip hardware engineers found that the new Gregorian calendar still contained flaws, and that the month of November should be counted up to 31 days instead. Not sure what you mean, the patch notes definitely make it sound like the Rockchip engineers did it intentionally...
- OJFord 5y agoI disagree, I found it very funny. Unprofessional perhaps, but funny.
- asdfasgasdgasdg 5y agoI don't agree. The one line summary should be enough to contextualize the rest. It isn't necessary to suck the joy out of funny commit messages to help the few people who don't bother to read the summary. Of course, naming variables funny names is probably a less good idea since variables will often have to convey meaning on their own. But that isn't true of the funny paragraph in this commit.
- nottorp 5y agoWell, HN doesn't like humour. It looked very clear to me.
- jiofih 5y agoWhy would anyone be confused by this? EDIT: I guess the submission title has been changed.
- KineticLensman 5y agoYes, the original title stated that Rockchip had found flaws in the Gregorian calendar
- msk-lywenn 5y agoPrevious discussion: https://news.ycombinator.com/item?id=10768140 https://news.ycombinator.com/item?id=10768140
- eqvinox 5y agoGiven the shoddy PCIe interface¹ in the RK3399, I'm left with exactly zero surprise about this. Doesn't make it less funny though :D ¹ https://news.ycombinator.com/item?id=26160229 https://news.ycombinator.com/item?id=26160229
- saagarjha 5y agoThere is nothing drier than the wit of an exasperated engineer writing workarounds for shoddy software.
- dannyw 5y agoShoddy hardware here, not shoddy software.
- nousermane 5y agoShort of decapping and studying RK808 silicon, there is probably no way to tell with certainty whether this is a hardware bug, or a software bug, in what could easily turn out to be ROM for an internal 8051 core.
- toxik 5y agoIf it’s a ROM, it’s arguably hardware - hard as in immutable.
- andy_ppp 5y agoNot sure software that can’t be changed turns into hardware!
- saurik 5y agoYeah, I feel that's at best "firmware", but I would be very confused by "hardware"... watch there be some amazing term like "steadyware" ;P.
- mjevans 5y agoI thought it was... Hardware - Immutable without physical destruction Firmware - Possible, but abnormal, to change (maybe limited times, risky) Software - Easiest to update, often during normal system lifetime Wikipedia's definition disagrees though, since it agrees that ROM is firmware (I agree EPROM is firmware since it can be modified with more extreme measures), but I suggest that is less correct than the categorization I outlined as I would like to include FPGAs, etc.
- mrweasel 5y agoMaybe I missing the point, but why would a chip/driver need its own calendar?
- flafla2 5y agoit was a bug.
- dmitrygr 5y agoSadly some do! The best kind of RTC in hardware is a second counter that the OS can program as it pleases. This design choice offers the least chance to mess it up. Yet, for some reason so many companies invent over-complicated RTC hardware blocks that count days, weeks, time zones, moon phases, and who the hell knows what else. Most of them suffer from myopic design (I've seen chips with y2k issues in hardware) or outright bugs (as seen in TFA). You know what most drivers do to those? They use them as second counters in the simplest way the driver writer could imagine. And yet, more and more chips keep being made with over-complex RTCs
- exikyut 5y agoWhat's a good knee-jerk "use this" recommendation that's inexpensive and likely to exist for a long time? Popularity and/or intuitivity would be nice bonuses, but I'd value functionally correct/sane behavior more highly. (I'm guessing this question belies my extreme ignorance of the field :), and that the RTCs in even eg basic Arduino etc designs are probably already reasonably decent.) Edit: Just noticed the parent sibling comment about RTCs obviating divide/multiply logic. Much clicks into place now.
- marcan_42 5y agoYou don't buy RTCs. You buy a big SoC with a 5000 page datasheet, of which 3-10 pages are the RTC, and you take what they give you. There is no room for the RTC type/design to be part of the part selection process for a SoC, which is why they can be vaguely crappy and nobody cares or can do anything about it. Edit: it's a power management IC for a SoC, not the SoC itself, but you often don't get much choice of those either since SoCs tend to be designed to pair with a specific PMIC. Whether the RTC is in the SoC or PMIC (or both) depends on the design.
- FriedrichN 5y agoTime and dates are awful enough without having to deal with hardware feeding you bogus data. I could imagine that if you were unaware of this that you could really drive yourself insane thinking your code isn't right.
- chaboud 5y agoThe false reverence in this is hilariously consistent. You can just feel the angst dripping through the page.
- raverbashing 5y agoThis is why we can't have nice things. Sigh. Of course, "fix it in software" is cheaper. Sigh. I know, I know, crap happens. But a review of something that basic should have been caught by someone at an earlier stage.
- branneman 5y agoWell, that is the point of software, to change quicker and cheaper.
- raverbashing 5y agoDoesn't mean you should do things wrong in hardware.
- jacoblambda 5y agoHad they used random constrained testing (property based testing/quickcheck for the HW world) on the HDL for their design, this likely wouldn't have gotten past even the initial review phase.
- kochie 5y agoWe're quickly approaching the point where it's going to be easier (and cheaper) to fix calendar glitches in reality rather than in the kernel.
- allendoerfer 5y agoWaterfall for calendars does not work. The code IS the design.
- Archelaos 5y ago"... just like more than 300 years went by before the last Protestant nation implemented Greg's proposal ..." This is not correct. The last Protestant nation that adopted the Gregorian calendar was Sweden. The adoption was stepwise (including some oddities) and was complete in 1753 (less than 200 years). The Swiss canton of Grissons (which was half Protestant and half Catholic) adopted it in 1811. It was the Orthodox countries that took more than 300 years to adopt it. The last one was Greece in 1923. Ever wondered why Calendar components in Microsoft's WinForms framework does not go further back then 1753? -- It was the first year when the British Empire fully used the Gregorian calendar (the transition was in 1752). Protestant software ...
- ZeroGravitas 5y agohttps://amp.theatlantic.com/amp/article/470418/ https://amp.theatlantic.com/amp/article/470418/ Or more precisely, DOS is Protestant and Windows is Anglican, as discussed by Umberto Eco.
- whiddershins 5y ago260 years?
- OJFord 5y agoThe quote says 'went by before the last', i.e. counting from introduction to adoption; not adoption to present ('have gone by since'). The Gregorian calendar was introduced in 1582 according to Wikipedia, so less than 200 by GP's comment.
- deleted 5y ago[deleted]
- nradov 5y agoTechnically the Serbian Orthodox Church still hasn't adopted the Gregorian calendar, so their religious holidays continue to gradually fall further out of sync with the rest of the world. Eventually they'll have Christmas in July.
- deleted 5y ago[deleted]
- sampo 5y agoBoth the "Rockchip engineers found that the Gregorian calendar contained flaws" in the title, and the "in A.D. 2013 Rockchip hardware engineers found that the new Gregorian calendar still contained flaws, and that the month of November should be counted up to 31 days instead" in the post are sarcasm. Apparently the Rockchip chip has a bug, where November has 31 days. And you need to have this workaround in software.
- zdw 5y agoOP here. It took me a while to edit down the original author's wit into something that would fit in the HN title box. Apologies to those who this confused - IMO that humor was one of the best features of the commit message. It feels somewhat unfortunate that the post title has been changed and is now just bland and boring.
- anticristi 5y agoI don't get why the RTC doesn't use seconds since some epoch. Encoding calendar in hardware/firmware feels wrong. Somewhat on a tangent, why don't we use TAI in hardware, since UTC is discontinuous?
- russdill 5y agoProbably has to do with hardware and firmware roots. Building an RTC that is programmable with year, month, day, hour, minute, second without multiplication and division is much much easier if you store the date time in year, month, day, hour, minute, second. You just need some simple comparisons whenever there is a rollover.
- wiml 5y agoApparently the comparisons aren't simple enough that people get them right, though.
- RcouF1uZ4gsC 5y ago> author Julius Werner <jwerner@chromium.org> Can we call this calendar the “Juliun Calendar”?
- kzrdude 5y agoI don't think he wants the tarnish, look at rockchip
- anticristi 5y agoI'm sure there is an alternative calendar proposal that makes this a feature and not a bug. Kind of sad that we, as a planet, haven't managed to adopt a more uniform calendar. Here is my favourite: https://en.m.wikipedia.org/wiki/Symmetry454 https://en.m.wikipedia.org/wiki/Symmetry454
- layer8 5y agoWe can’t even agree on when to have DST transitions (or not having them at all).
- diebeforei485 5y agoThis is a cryptic / sarcastic commit message throwing shade at Rockchip because their chip had a hardware bug counting 31 days in November. Looks like it's caused confusion just 5 years later. Commit messages ideally shouldn't be like this, they're meant to be read by other humans in the future.
- slver 5y agoI'm learning all the wrong lessons here. Like, I'm super tempted, to file my next bug as "Flaw in laws of universal order causing perfect software to misbehave in specific conditions"
- st_goliath 5y ago> Looks like it's caused confusion just 5 years later. No. The commit message is perfectly clear, the first line (the one highlighted in bold, which was also the subject line on the original mail) summarizes exactly what this is about, the first paragraph, although containing some mild sarcasm, is IMO perfectly clear about what the exact problem is and the second part explains how it is solved. The only thing that is causing confusion is the headline on HN, by ripping a single sentence completely out of context. EDIT: The title has now been changed to something less clickbaity. At the time I wrote this comment, it was "in 2013 Rockchip hardware engineers found that the new Gregorian calendar still contained flaws"
- BitPirate 5y agoYou think this is bad? Take a look at the japanese calendar: https://en.m.wikipedia.org/wiki/Japanese_era_name https://en.m.wikipedia.org/wiki/Japanese_era_name Imagine having to hotpatch a lot of the governments software because there's a new emperor. Previous discussion: https://news.ycombinator.com/item?id=17430085 https://news.ycombinator.com/item?id=17430085
- senbarryobama 5y agoThis is a terrible commit message.
- VMG 5y agois it normal that these methods have no tests?
- goodgrief99 5y agoWhat a terrible calendar do we currently have. One guy offered this one: 28x13=364. In that case we have 13 months each of 28 days. Strict 4 weeks in one month. 365 and 366 are non-calendar holidays.
- berkes 5y agoYou'd still need leap-days, then, though. Otherwise, in 150 years, june, or whatever is the 6th month, has drifted from summer to winter (or viceversa) by then. Another issue, is that while 28 is neatly divisible, 13 is not. What is half a year? When do you make up the numbers for Q3? etc. It introduces so much issues, that the net-benefit is hardly there.
- Taek 5y agoThat sounds pretty fun. Imagine moving leap day to New Years, so that every once in a while we have a 2 day party instead of a one day party.
- toast0 5y agoThat's what we have, september is month 7, october is month 8, november is month 9, december is month 10, february is the last month, and february 29 is an intercalary day. Someone just fucked up the offset at some point.
- yjftsjthsd-h 5y ago> 365 and 366 are non-calendar holidays. Except that people can still be born and die and check in and out of hospitals on those days, so you have to be able to record those days, so they immediately get back onto the calendar but in a far uglier and more hacky way than the entire system that you just tried to replace.
- Tempest1981 5y agoJust curious why 7 days is the optimal week-length? Why not 8 days (5 work, 3 day weekend)? Or 6 days (4 + 2)
- z3t4 5y agoThere are two things in software that I try to stay away from: Bluetooth issues and calendar/dates...
- bombcar 5y agoClearly the correct solution would be to over-engineer a standard allowing for support for all arbitrary calendars.
- userbinator 5y agoThe most disturbing thing about this bug is that an RTC which can count days of the month and even leap years correctly is not at all new leading-edge technology. The pattern is simple enough that you can write a single expression to calculate it, which could be compiled down to a similarly compact arrangement of gates, but I'm guessing someone went the "lame" way with an array of entries -- and typo'd the November entry. Then no one noticed nor tested until it was far too late. With the exception of February and an inversion after July, the pattern alternates binarily between 30 and 31. Thus, assuming zero-based months, days = 30 + ((m+1 & 1) ^ (m > 6)) - (2 - isleap) * (m == 1);