inc/DB.php
authorAlan Knowles <alan@akbkhome.com>
Thu, 27 Jan 2011 14:24:32 +0000 (22:24 +0800)
committerAlan Knowles <alan@akbkhome.com>
Thu, 27 Jan 2011 14:24:32 +0000 (22:24 +0800)
inc/DB.php

index f3fd4d8..1afe2e3 100644 (file)
@@ -15,21 +15,22 @@ class MTrackDB {
 
   // given a unix timestamp, return a value timestamp string
   // suitable for use with the database
-  static function unixtime($unix) {
-    list($unix) = explode('.', $unix, 2);
-    if ($unix == 0) {
-      return null;
-    }
-    if ($unix < 10) {
-      throw new Exception("unix time $unix is too small\n");
-    }
-    $d = date_create("@$unix", new DateTimeZone('UTC'));
-    // 2008-12-22T05:42:42.285445Z
-    if (!is_object($d)) {
-      throw new Exception("failed to create date for time $unix");
+    static function unixtime($unix) 
+    {
+        list($unix) = explode('.', $unix, 2);
+        if ($unix == 0) {
+          return null;
+        }
+        if ($unix < 10) {
+          throw new Exception("unix time $unix is too small\n");
+        }
+        $d = date_create("@$unix", new DateTimeZone('UTC'));
+        // 2008-12-22T05:42:42.285445Z
+        if (!is_object($d)) {
+          throw new Exception("failed to create date for time $unix");
+        }
+        return $d->format('Y-m-d\TH:i:s.u\Z');
     }
-    return $d->format('Y-m-d\TH:i:s.u\Z');
-  }
 
     static function get() 
     {