Slashdot Mirror


Adobe and Apple Didn't Unit Test For "Forward Date" Bugs. Do You?

llamafirst writes "As the year flipped to 2013, we learned that Adobe and Apple don't test for "forward date" bugs. Adobe prevented any copy of FrameMaker 10 from launching and Apple broke Do Not Disturb for the first week of 2013. Surely some more critical and safety systems also have lurking issues. Got tips for catching time/date bugs 'from the mysterious future?' (Also, obligatory link to Falsehoods programmers believe about time.)"

24 of 169 comments (clear)

  1. leap year by d3matt · · Score: 3, Interesting

    2012 cost us a decent chunk of change because for the third product line in a row, we screwed up seconds since epoch calculations... Every single customer was out of commission until we released a patch!

    --
    I am d3matt
    1. Re:leap year by LinuxIsGarbage · · Score: 3, Informative

      Christ. Year after year, iOS alarm clock, DND, or something breaks on new years, leap year, DST, or something.

      IT JUST WORKS!!!!!

      https://discussions.apple.com/thread/3795574?start=0&tstart=0

      http://www.engadget.com/2011/03/14/ios-daylight-saving-time-woes-continue/

    2. Re:leap year by egranlund · · Score: 3, Interesting

      Yeah, I don't entirely understand why apple is having such a rough time getting basic time keeping and scheduling working...

    3. Re:leap year by Carewolf · · Score: 2

      Yeah, basic mobile phones deal with this problem much better than Apple, probably by doing nothing and just asking the GSM net what time it is. Why handle DST when the network can tell you what the local time adjusted for all recent legislation and leap seconds is?

  2. Neither did Google by Anonymous Coward · · Score: 3, Informative

    They left December out of Android Jelly Bean's date picker.

    1. Re:Neither did Google by Qzukk · · Score: 2

      Has anyone come up with a good way to test user interfaces yet other than to have someone sit slack-jawed and wiggle everything they see on the screen for hours on end?

      --
      If I have been able to see further than others, it is because I bought a pair of binoculars.
  3. OP change the title by Anonymous Coward · · Score: 2, Insightful

    Why add "Unit Test?" just say "Test" unless you really mean a unit test.

  4. Why? by gr8_phk · · Score: 4, Interesting

    Got tips for catching time/date bugs "from the mysterious future"?

    Why does software functionality depend on the date? Calculation issues maybe... but failure to lauch? WTF? I'm most curious to learn how this even happens.

    1. Re:Why? by Tanuki64 · · Score: 2

      Stupid copy restriction?

    2. Re:Why? by Zadaz · · Score: 2

      Why does software functionality depend on the date? Calculation issues maybe... but failure to lauch? WTF?

      Some kind of half-assed copy protection or trial use. "Dude, you totally changed the date to get around our 30 day trial! No more software for you!"

      Stupid, yes. But it exists.

    3. Re:Why? by Hentes · · Score: 2

      These depend on time, not date.

    4. Re:Why? by sonamchauhan · · Score: 2

      See this link for an example: http://www.wmusers.com/forum/archive/index.php/t-5470.html

      webMethods' 'Trading Networks' B2B integration software (now owned by Software AG) used a GUID-generator routine which created 24-byte GUIDs for processing B2B documents. One of the inputs to this routine was the number of milliseconds between UTC and UNIX epoch.

      One day in 2004, the progress of time caused 25-byte GUIDs to be created. Trading Networks tried to insert these into a database column whose width was 24 bytes. So, at the same instant worldwide, none of their customers used this software could process B2B transactions!

    5. Re:Why? by gr8_phk · · Score: 2

      That's so stupid. If your code is going to generate a 24 byte GUID then it should do so under any valid set of inputs to the GUID generator. In fact, if there it's even possible to generate a larger number it should be truncated to 24 just to be sure. If date and time are going into it, you have to consider a reasonable range of dates. But thanks for the example, it shows how little effort some companies put in.

  5. I've had the opposite experience.... by Zapotek · · Score: 3, Interesting

    ...with forward dates braking my tests.
    I've had mock SSL certs and HTTP cookie jars that both expired and made it seem like the system was failing all over the place during unit/integration/general testing.

    So just watch out in general because this can swing either way...

    1. Re:I've had the opposite experience.... by muddysteel · · Score: 2

      funny real event: Co-worker could not get his email client to work. Connection is managed using SSL, and the tunnel setup was failing. The reported error was a certificate invalid. That didn't jive with the CA cert - it was issued a year ago and is good for like 20 years.

      After looking and looking and looking: He realized his system date was set to 1/1/1980 - his CMOS battery was dead.. Jan 1 1980 is prior to the start of the validity period for the CA cert in use.. ;)

    2. Re:I've had the opposite experience.... by Shimbo · · Score: 2

      Yeah, that's happened to me. Shouldn't that just work, though. I mean unless you've invented time travel, why wouldn't you accept a cert that's before its validity period? Is there a vulnerability use case that I'm not aware of?

      If your clock is resets to 1980, you don't know which certificates have expired. If you accept all, you run the risk of accepting a genuinely expired certificate. Although it would be more helpful to have the OS report implausible dates.

  6. 2038 by Dishwasha · · Score: 3, Informative

    I for one am stockpiling canned meat in my bomb shelter for 2038. By the time 2038 comes, software will be so virtualized and there will be so many layers between operational computer software and what's under the hood that it will take at least a decade to fix this problem in our future society.

    1. Re:2038 by sonamchauhan · · Score: 2

      Have your forward-date tested the edibility of your canned spam?

      If you plan to eat it in 2038, you really, really should, :)

  7. Forward testing by fyngyrz · · Score: 4, Funny

    Well, there was no point in forward testing after Dec 21, 2012, you see.

    --
    I've fallen off your lawn, and I can't get up.
  8. Very simple...but misses many common needs by DragonWriter · · Score: 3, Insightful

    Points in time are *always* represented internally as seconds-since-epoch (or milliseconds, or whatever unit makes sense for your app). Calculations are always done on values which are seconds-since-epoch. The *only* time that a date is *ever* converted to a year/month/day hour:min:sec representation is strictly for display purposes.

    Frequently, calculations require both points in times and intervals of time; the former can consistently be represented as seconds since epoch, the latter doesn't really have a usable equivalent (you could use just seconds, but then things don't work as expected, since often its actually important to the user that the interval be an exact number of days, weeks, months or years, which may not be reducible to a consistent number of seconds, but instead that will depend on how the point in time the offset is being calculated against is represented in Year/month/day/hour/minute/second form, because leap seconds, leap years, and different lengths of months all make interval calculations tricky.)

    You can't restrict conversion of seconds-since-epoch to calendar format to display-purposes-only if you are going to do anything useful with dates.

  9. Automated testing by LordStormes · · Score: 2

    My shop has over 800 automated test scripts, all of which have been running on machines that think it's 2013-2014 for over a year, and will be bumped up to 2014-2015 by the end of the month.

    1. Re:Automated testing by Anonymous Coward · · Score: 2, Insightful

      Why is he full of shit? Any professional business that produces software has automated scripts doing such testing. We do full regression tests on a weekly basis and nightly break tests including future dates. We run thousands of scripts. If you think that is full of shit you need to stay the fuck away from software development.

  10. Re:Correct on embedded, see link... apk by rubycodez · · Score: 3, Informative

    I could supply link, or better yet let's make the proof this thread. See how timestamp beyond 2038-01-19 03:14:07 gets foobared.

    rubycodez@hyperion:~$ mysql -u root -p
    Enter password:
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 40
    Server version: 5.5.28-0ubuntu0.12.04.3 (Ubuntu)

    Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    mysql> create database timedb;
    Query OK, 1 row affected (0.00 sec)

    mysql> use timedb;
    Database changed
    mysql> create table tvalue(t timestamp);
    Query OK, 0 rows affected (0.00 sec)

    mysql> insert into tvalue values ('2012-12-21');
    Query OK, 1 row affected (0.00 sec)

    mysql> insert into tvalue values ('2038-01-30');
    Query OK, 1 row affected, 1 warning (0.00 sec)

    mysql> select * from tvalue;

    | 2012-12-21 00:00:00 |
    | 0000-00-00 00:00:00 |

    2 rows in set (0.00 sec)

    mysql>

  11. Re:It's very simple... by GravityStar · · Score: 2

    Bull, I find bugs all the time *because* dd/mm/yyyy in applications is often stored/operated on with millisecond/second precision.
    Let's see:
    a) the case of the missing midnight: some date or another in the 1920's IIRC that doesn't have a 00:00:00 hour but that day starts at 02:00:00 hour (so, two missing hours). Unable to create or store that date with the time set at midnight.
    b) range 01/01/2012 - 10/12/2012 entered by the user, inclusive. On 10/12/2012 00:00:01 the system determines the current date is no longer in the range. Bug, certainly not what the user intended.
    c) amount of days between 1/1/2012 CET and 1/6/2012 CEST. A naive way to calculate this is is to subtract the two dates (with millisec precision) and divide by 24 hours. That will give the wrong answer though.

    Anyway, I've come to believe that in an application you store/use the date the user typed in, not a derivative with millisecond precision.

    And, also agree with DragonWriter above.