summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
authorUrban Müller2014-07-31 14:48:56 +0200
committerUrban Müller2014-07-31 14:48:56 +0200
commit6688ddbd65983239d28ea8b1da5e70030ae88c6f (patch)
treea9e5a7f8b3551eacc8e31746eef1e583dc3ee65c /it.class
parent4913c5d128abe3987bb16e462dad6543bf522f63 (diff)
downloaditools-6688ddbd65983239d28ea8b1da5e70030ae88c6f.tar.gz
itools-6688ddbd65983239d28ea8b1da5e70030ae88c6f.tar.bz2
itools-6688ddbd65983239d28ea8b1da5e70030ae88c6f.zip
support it::time
Diffstat (limited to 'it.class')
-rw-r--r--it.class12
1 files changed, 10 insertions, 2 deletions
diff --git a/it.class b/it.class
index 64a2f51..f514537 100644
--- a/it.class
+++ b/it.class
@@ -859,6 +859,14 @@ static function gets()
}
/**
+ * Like time() but overridable via debug param
+ */
+function time()
+{
+ return ($t = EDC('time')) ? strtotime($t) : time();
+}
+
+/**
* Output formatted and localized date
* @param format optional format (default is 2007-01-02 03:04:05).
* Other formats are "date", "datetime", "time".
@@ -870,9 +878,9 @@ static function gets()
static function date($format = "", $stamp = null)
{
if (!isset($stamp))
- $stamp = EDC('time') ? strtotime(EDC('time')) : time();
+ $stamp = it::time();
else if (is_string($stamp) && !ctype_digit($stamp))
- $stamp = strtotime($stamp);
+ $stamp = strtotime($stamp, it::time());
list($name, $language) = explode(":", $format);