Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv24883
Modified Files:
defaults-dist.php metar_parser.php
Log Message:
Hacking around a bug in PHP function gmmktime
Index: defaults-dist.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/defaults-dist.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- defaults-dist.php 2001/07/17 12:15:08 1.8
+++ defaults-dist.php 2001/12/20 19:11:47 1.9
@@ -41,4 +41,7 @@
$this->properties['language'] = 'en'; /* phpweather.php */
+// hack around PHP bug - the offset to add to a time reported
+$this->properties['offset'] = 0;
+
?>
Index: metar_parser.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/metar_parser.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- metar_parser.php 2001/12/19 10:07:13 1.12
+++ metar_parser.php 2001/12/20 19:11:47 1.13
@@ -184,10 +184,13 @@
*
* We return a standard Unix UTC/GMT timestamp suitable for
* gmdate().
- * There has been a report about the time being wrong. If you
- * experience this, then change the next line. You should
- * add/subtract some hours to $regs[2], e.g. if all your times
- * are 960 minutes off (16 hours) then add 16 to $regs[2].
+ * Due to a bug in PHP, on some systems the time reported may
+ * be incorrect. If you experience this, you can set
+ * $this->properties['offset'] to be the offset to add. For
+ * example, if your times generated are 1 hour too early (so
+ * metars appear an hour older than they are), set
+ * $this->properties['offset'] to be +1 in your defaults.php
+ * file.
*/
if ($regs[1] > gmdate('j')) {
/* The day is greather that the current day of month => the
@@ -197,7 +200,7 @@
} else {
$month = gmdate('n');
}
- $decoded_metar['time'] = gmmktime($regs[2], $regs[3], 0, $month, $regs[1], gmdate('Y'));
+ $decoded_metar['time'] = gmmktime($regs[2]+$this->properties['offset'], $regs[3], 0, $month, $regs[1], gmdate('Y'));
} elseif (ereg('(AUTO|COR|RTD|CC[A-Z]|RR[A-Z])', $part, $regs)) {
/*
|