summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2006-05-21 03:10:53 +0200
committermkanat%bugzilla.org <>2006-05-21 03:10:53 +0200
commit7a4bbc15e2a73382bc9eaf1b168a620bbd16db97 (patch)
tree62ecf81ef9281ddcd37ff27703c67af3cec79c2d
parent232d08fe800c1c36a9bb74953eeac2f4a2d188c3 (diff)
downloadbugzilla-7a4bbc15e2a73382bc9eaf1b168a620bbd16db97.tar.gz
bugzilla-7a4bbc15e2a73382bc9eaf1b168a620bbd16db97.tar.xz
Bug 337782: Change the way that whine.pl gets and formats the current date
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=justdave
-rwxr-xr-xwhine.pl17
1 files changed, 7 insertions, 10 deletions
diff --git a/whine.pl b/whine.pl
index 2fd80a3e3..7e4ec5285 100755
--- a/whine.pl
+++ b/whine.pl
@@ -111,16 +111,13 @@ if (open(NOMAIL, '<', "$datadir/nomail")) {
}
}
-# get the current date and time from the database
-$sth = $dbh->prepare('SELECT ' . $dbh->sql_date_format('NOW()', '%y,%m,%d,%a,%H,%i'));
-$sth->execute;
-my ($now_year, $now_month, $now_day, $now_weekdayname, $now_hour, $now_minute) =
- split(',', $sth->fetchrow_array);
-$sth->finish;
-
-# As DBs have different days numbering, use day name and convert it
-# to the range 0-6
-my $now_weekday = index("SunMonTueWedThuFriSat", $now_weekdayname) / 3;
+# get the current date and time
+my ($now_sec, $now_minute, $now_hour, $now_day, $now_month, $now_year,
+ $now_weekday) = localtime;
+# Convert year to two digits
+$now_year = sprintf("%02d", $now_year % 100);
+# Convert the month to January being "1" instead of January being "0".
+$now_month++;
my @daysinmonth = qw(0 31 28 31 30 31 30 31 31 30 31 30 31);
# Alter February in case of a leap year. This simple way to do it only