On Fri, May 14, 2010 at 20:56, Dongsheng Song <dongsheng.s...@gmail.com> wrote:
> Hi forks,
>
> On my windows box (UTC+8), the following python code give me 22724
> (python 2.6.5 or 3.1.2), but on people.apache.org
>
> (python 2.6.4), I got
> :22722:
>
> from datetime import datetime;
> dt = datetime.now() - datetime(2000, 1, 1, 0, 0, 0);
> round((dt.days * 24 + dt.seconds / 3600) / 4)

Well, first you want to ensure that you're performing that math using
floating point values, since dt.days and dt.seconds are integers.
Thus:

round((dt.days * 24. + dt.seconds / 3600.) / 4)

In any case, it looks like you're counting the number of 4-hour
periods since January 1, 2000. people.apache.org is in a different
time zone, so it is reporting a different number of hours. That's all.

btw, in Python, you don't really want/need those trailing semicolons :-)

Cheers,
-g

Reply via email to