diff options
Diffstat (limited to 'lib/Utility/Time.php')
-rw-r--r-- | lib/Utility/Time.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/Utility/Time.php b/lib/Utility/Time.php new file mode 100644 index 000000000..e6ea2b470 --- /dev/null +++ b/lib/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 |