- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Considering the Zune OS is really Windows CE, there's no excuse for such code at all. Especially since Windows CE exposes a full set of date-related computation functions for you. I've worked on RTC drivers, and the way to get things set up is to take the current SYSTEMTIME and either program it into the hardware directly (a lot of hardware chips do BCD day/date/month/year/hour/minute/second calculations internally), or if it's lamer and does a seconds-since-some-epoch, you convert the SYSTEMTIME to a FILETIME (64 bit monotonically increasing humber since Jan 1904 - 100ns increment interval), compute the difference to your chosen epoch FILETIME, then convert from that to seconds (a nice round number... 10 million I believe), and boom, you're done.
The only reason in the world to test a date would be to ensure that it's within bounds, and it's just checking that day of week is 0-6 (or 1-7), the months have proper days (only reason to need a leap-year test, and that code is around), and the month is between 0-11 (or 1-12) before starting the computation. Anytime I have to start writing code with dates, there's no reason to not use OS provided functions. Small embedded systems probably don't have date functions, but then again, maybe that's an indication to try to rewrite your code to either not use dates at all, or push the date stuff to a more powerful processor with an OS and date functions.
Admin
And I thought Apple's address was 1 Infinite Loop :-D
You'd really think a company would run some unit tests on their firmware before shipping a gazillion devices (they wish), but no...
Admin
Ugh... bad memories of Zune2k9, which I just had to go through. When will we learn that leap years happen every 4 years and have 366 days?
Admin
To be fair, the original firmware worked just fine and a lot of people fixed their Zunes by disconnecting the batteries and forcing it to reset to its original firmware. It was one of the firmware updates after they had shipped tens of units that caused the infinite loop.
Admin
Admin
She is an actress and was, back in the 80s, a member of the "Brat Pack" along with Emilio Estevez, Anthony Michael Hall, Andrew McCarthy, Judd Nelson, Demi Moore, Ally Sheedy and some others I'm probably forgetting.
She's the ginger haired one from "The Breakfast Club". She was also in "Not Another Teen Movie" as a cameo, the check-in attendant at the end, iirc.
Admin
Admin
Admin
If I recall, I had trouble getting my Wang back up in 1984!
If only I knew there was someone else to blame.
Admin
Admin
I think you need to double check your "code review module"
while (days > 365) should return false and day 365 will return. Now try day 366 on a leap year and you will see a real problem.
Admin
Wang VS, eh? Sounds like cockfighting to me...
Admin
You can't beat a Wang for a good date.
Admin
i'd just started with a new co., and the proj. was a cobol fin.mgt system on a wang...the file sys. had 1 dir. level, but the dynamic linking made programming in that limited space easy:-)
Admin
Admin
Using "grinded" rather than "ground" makes it sound like you should break the banjos out.
Admin
My thoughts were more like: What the hell is a Wang?
Admin
If you don't know what a Wang is, are you sure you're a dude? Where's your dignissim?