diff options
Diffstat (limited to 'utility')
-rw-r--r-- | utility/time.php | 30 |
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 |