IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Sacre Blue! A bug! 93+ days according to HP-41CX
:-)

That web link actually says -153 days till election day at the moment. There seems to be a bug in that [link|http://www.seattlewebcrafters.com/php/countdown_code.html|PHP code].

[link|http://helios-arts.com/clock.html|This] active election count-down clock seems accurate.

Cheers,
Scott.
New Re: Sacre Blue! etc
Could it be (since you have the trusty HP handy) that they are counting down to the actual (devoutly to be hoped) earliest date for regime change, i.e., 20 January?

cordially,
Die Welt ist alles, was der Fall ist.
New Not as I read the code.
// Get server timestamp
$today = time();

// Get number of days from today until the end of this year
$rest_of_year = date('z', mktime(0,0,0,12,31,date('Y', $today))) - date('z', $today);

// Get number of days from the 1st of 2004 to election day
$election = date('z', mktime(0,0,0,11,2,2004));

// Add the days remaining in this year to the number of days in 2004 prior to election day
$countdown = $rest_of_year + $election;


It seems clear enough that they're making a mistake in the calculation.

I think it should be:

$countdown = $election - ($length_of_year - $rest_of_year);

or more simply:

$countdown = $election - $today;

(where $length_of_year is calculated using the date function).

Checking:

July 31 is the 213th day of the year, so 153 days remain (leap year and all that) in the year. Election day is November 2, 306 days from the start of the year and 59 days from the end of the year, so the net is 153 - 59 = 94 days (or 93+ days). To get -153 days, they must have taken 153 - 306 days.

The coder apparently got mixed up in knowing whether s/he was counting from the first or the end of the year.

Or something like that.

Cheers,
Scott.
New Duh
Days between dates is a trivial problem - julday(date2) - julday(date1) - how is it possible to mess this up?
-drl
New A triumph of algorithm VS adding a few months' days in head
New Some of us have regressed to ~ 2nd grade in maths. :-(
     Hope...is... on ....the ...way... - (danreck) - (24)
         Some delegation chair voted for "John Fitzgerald Kerry" :-/ -NT - (Another Scott) - (9)
             holy cran that is bad - (deSitter) - (8)
                 anything is possible in america - (boxley) - (7)
                     LRPD? I vote yes (if I voted) - (danreck) - (6)
                         Re: LRPD? I vote yes (if I voted) - (deSitter) - (5)
                             want to understand Korea? - (boxley)
                             You need to read about WWI - (jake123) - (2)
                                 Not for us - (deSitter) - (1)
                                     We were in both for the full haul - (jake123)
                             Re: LRPD? I vote yes (if I voted) - (danreck)
         40 year old remembers Jim Crow - (rcareaga) - (12)
             dont you mean jaime cuervo? -NT - (boxley) - (1)
                 ha, ha - (rcareaga)
             Thank you, thank you, thank you, thank you, thank you, etc. - (danreck) - (9)
                 the cult: this just in - (rcareaga) - (8)
                     Others had similar thoughts about the advantage of Bush win. - (Another Scott) - (7)
                         fuzzy calendar - (rcareaga) - (6)
                             Sacre Blue! A bug! 93+ days according to HP-41CX - (Another Scott) - (5)
                                 Re: Sacre Blue! etc - (rcareaga) - (4)
                                     Not as I read the code. - (Another Scott) - (3)
                                         Duh - (deSitter)
                                         A triumph of algorithm VS adding a few months' days in head -NT - (Ashton) - (1)
                                             Some of us have regressed to ~ 2nd grade in maths. :-( -NT - (Another Scott)
         Gracias a los Dioses Corporativos cha cha - (Ashton)

Group you belong to is wrong group.
49 ms