summaryrefslogtreecommitdiffstats
path: root/utility
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2016-07-23 18:34:17 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2016-07-23 18:34:17 +0200
commit9b1fe46fe995bc103d3c5cfa9a552d050ff0ead8 (patch)
tree7b86abb65272df89f61e849a08edef5326207b8a /utility
parentb88d42074dcd0842d0db3ca8ed24b0b9ccb78a7a (diff)
Add timestamps for all entities in milisecond unix time format
Diffstat (limited to 'utility')
-rw-r--r--utility/time.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/utility/time.php b/utility/time.php
new file mode 100644
index 000000000..e6ea2b470
--- /dev/null
+++ b/utility/time.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Bernhard Posselt 2016
+ */
+
+namespace OCA\News\Utility;
+
+class Time {
+ public function getTime() {
+ return time();
+ }
+
+ /**
+ * @return int the current unix time in miliseconds
+ */
+ public function getMicroTime() {
+ $utimestamp = microtime(true);
+ $timestamp = floor($utimestamp);
+ $milliseconds = round(($utimestamp - $timestamp) * 1000000);
+ $result = ($timestamp * 1000000) + $milliseconds;
+ return $result;
+ }
+
+} \ No newline at end of file