Go Back   Zune Boards > News and Website Related > Front Page Articles > Archive

Archive Archived Front Page Articles.

Closed Thread
 
Thread Tools
Old 01-06-2009, 01:26 PM   #81
Charge
If I'm not online, I probably am
Senior Editor
Support Team
GFX Crew
Premium Member
Super Moderator
Holy Zuner
 
Charge's Avatar
 
Join Date: Aug 2007
Location: England
Posts: 8,889
Charge has a brilliant futureCharge has a brilliant futureCharge has a brilliant futureCharge has a brilliant futureCharge has a brilliant futureCharge has a brilliant futureCharge has a brilliant futureCharge has a brilliant futureCharge has a brilliant futureCharge has a brilliant future
Default

What is the problem, maybe we can help
__________________

To view links or images in signatures your post count must be 5 or greater. You currently have 0 posts.



Charge is offline  

Advertisement [Remove Advertisement]

Old 01-06-2009, 06:27 PM   #82
ghst
Zewbie
 
Join Date: Dec 2008
Posts: 5
ghst is on a distinguished road
Default

hmm i don't know if i'll even have my zune 30 in four years




ghst is offline  

Old 01-08-2009, 12:03 PM   #83
MercifulBoss
Experienced Zuner
 
Join Date: Jun 2008
Location: On a single planets of many in this universe....
Posts: 150
MercifulBoss is on a distinguished road
Default

Quote:
Originally Posted by twhoffman View Post
That would prevent the infinite loop, but would introduce a new bug where it advances the year on the last day of a leap year. It would have thought today was December 31, 2009. That's better than locking up, but it also would mean that all time-limited DRM media would stop working. So, if you have a Zune Pass, none of your songs would play.

What's needed is a break within an else like this (I hope, my C's a little rusty, and was never that good to begin with):

Code:
year = ORIGINYEAR; /* = 1980 */

while (days > 365)
{
    if (IsLeapYear(year))
    {
        if (days > 366)
        {
            days -= 366;
            year += 1;
        }
        else
        {
            break;
        }
    }
    else
    {
        days -= 365;
        year += 1;
    }
}
Why would doing "days >= 366" advance forward a year? Wouldn't it simply say that if days = 366 or greater than 366 then do the below code?




MercifulBoss is offline  

Old 01-09-2009, 10:01 AM   #84
twhoffman
Zewbie
 
Join Date: Dec 2008
Posts: 6
twhoffman is on a distinguished road
Default

Quote:
Originally Posted by MercifulBoss View Post
Why would doing "days >= 366" advance forward a year? Wouldn't it simply say that if days = 366 or greater than 366 then do the below code?
You're correct. If days == 366 or days > 366, it would execute the code. That code includes advancing the year:

Code:
  days -= 366;
  year += 1;
Here's what would happen. On December 31, 2008, days == 366 and year == 2008, with the original code, it would enter the loop because days > 365, but never execute the leap year code because it expects days > 366. If you change that to days >=366, it will execute the code, which is subtract 366 from days, making it 0, and add 1 to year, making it 2009.

What you're left with is day 0, 2009. Besides the year being off, you also wind up with an invalid day, since day == 1 on January 1. Day 0 would be a day that doesn't exist. That code wouldn't cause an infinite loop, but it would think it was January 0, 2009. I'm not sure what kind of bugs that would introduce, but at the very least, the year will be 2009.

I might be wrong. As I said, my C is rusty, but I'm pretty sure that's what will happen.



twhoffman is offline  

Old 01-09-2009, 04:31 PM   #85
Netrix
Purger of Ignorance
Development Front
Retired Staff
Super ZunerĀ²
 
Netrix's Avatar
 
Join Date: Jun 2008
Location: In my own world
Posts: 4,268
Netrix has much to be proud ofNetrix has much to be proud ofNetrix has much to be proud ofNetrix has much to be proud ofNetrix has much to be proud ofNetrix has much to be proud ofNetrix has much to be proud of
Send a message via MSN to Netrix
Default

Quote:
Originally Posted by twhoffman View Post
I'm not sure what kind of bugs that would introduce, but at the very least, the year will be 2009.
If that is the only problem, it would be rather easy to add a check to make sure that there is no day "0". If there is, they could simply add one to the number of days, fixing that problem.




Netrix is offline  

Old 01-10-2009, 04:39 PM   #86
sono2351
Jr. Zuner
 
sono2351's Avatar
 
Join Date: Jan 2008
Location: Belleville, IL
Posts: 36
sono2351 is on a distinguished road
Send a message via AIM to sono2351 Send a message via Yahoo to sono2351
Default

just another reason why leap year babies are ruining the world...




sono2351 is offline  

Old 01-13-2009, 09:41 AM   #87
switchblade5984
Squirt
 
switchblade5984's Avatar
 
Join Date: Jun 2007
Posts: 19
switchblade5984 is on a distinguished road
Default

mine still doesnt work... funny, the 30 thats not working is my wife's pink one too

Last edited by switchblade5984; 01-13-2009 at 09:44 AM.



switchblade5984 is offline  

Old 01-14-2009, 12:33 AM   #88
Charge
If I'm not online, I probably am
Senior Editor
Support Team
GFX Crew
Premium Member
Super Moderator
Holy Zuner
 
Charge's Avatar
 
Join Date: Aug 2007
Location: England
Posts: 8,889
Charge has a brilliant futureCharge has a brilliant futureCharge has a brilliant futureCharge has a brilliant futureCharge has a brilliant futureCharge has a brilliant futureCharge has a brilliant futureCharge has a brilliant futureCharge has a brilliant futureCharge has a brilliant future
Default

Thats probably cuz you opened them. Am i correct?
__________________

To view links or images in signatures your post count must be 5 or greater. You currently have 0 posts.



Charge is offline  

Closed Thread

Bookmarks

Thread Tools
no new posts