changeset 196:a38c123921a9

Change the timestamp parsing.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 16 Jun 2014 02:28:24 +0300
parents 9eee4e1b757c
children 0fd2435371eb
files fetch_weather.pl
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/fetch_weather.pl	Mon Jun 16 01:54:56 2014 +0300
+++ b/fetch_weather.pl	Mon Jun 16 02:28:24 2014 +0300
@@ -58,8 +58,15 @@
 
 sub parse_timestamp($$)
 {
-  # XXX: A bit of a hack, but it works.
-  return Time::Piece->strptime($_[0], "%H:%M")->epoch + $_[1];
+  my ($str, $offs) = @_;
+  if ($str =~ /^(\d+):(\d+)$/)
+  {
+    return $offs + (60 * 60 * $1) + ($2 * 60);
+  }
+  else
+  {
+    return $offs;
+  }
 }