From: Eric Jacoboni Date: 2001-05-04T08:41:23+09:00 Subject: [ruby-talk:14604] Question about Date I've just discovered ruby and, to learn it, i'm trying to write some scripts. I've tried to create a script doing the same thing as a Perl script i've wrote to create my signature (see below). In Perl, i'm using Delta_DHMS to obtain the number of days of my poor existence. Then i multiply by 86400, like this: =-=-=-= #!/usr/bin/perl -w use Date::Calc qw/Delta_DHMS/; my @now = localtime; my @diff = Delta_DHMS(1960,5,21,0,0,0, $now[5] + 1900, $now[4] + 1, $now[3], $now[2], $now[1], $now[0]); my $result = $diff[3] + ($diff[2]*60) + ($diff[1]*3600) + ($diff[0]*86400); print "葡ic Jacoboni, born $result seconds ago.\n"; exit 0; =-=-=-=-=-=-= As far i've understand the first rules of ruby, i've wrote the following (here, i've cut the last line to fit the 72 char requirements): =-=-=-=-=-= #!/usr/local/bin/ruby require "date2" my_birthdate = Date.new(1960, 05, 21) printf "葡ic Jacoboni, born %d seconds ago.\n", \ (Date.today() - my_birthdate) * 86400 =-=-=-=-=-= My problem is that i don't get the same result in both cases: $ ./signature ; ./date.rb ; java MyBirthday 葡ic Jacoboni, born 1292375374 seconds ago 葡ic Jacoboni, born 1292371200 seconds ago. 葡ic Jacoboni, born 1292375374 seconds ago. As you see, there is 3743 seconds, one hour, between the result of the Perl script (the Java program gives the same result as Perl). Of course, ruby makes me younger, but that's not a good reason enough ;-) What could be the matter ? -- 葡ic Jacoboni, nil y a 1292374062 secondes.