123456789101112131415161718192021222324252627 |
- <?php
- /**
- * dolphin. Collection of useful PHP skeletons.
- * Copyright (C) 2019 Johannes 'Banana' Keßler
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
- *
- * You should have received a copy of the
- * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
- * along with this program. If not, see http://www.sun.com/cddl/cddl.html
- */
- /**
- * creates a high-precision UNIX timestamp
- * https://docs.microsoft.com/en-us/dotnet/api/system.datetime.ticks
- *
- * @return int
- */
- static function timeticks() {
- $mtime = microtime();
- $parts = explode(' ', $mtime);
-
- # Using a string here to prevent overflow
- # PHP converts it to a double
- return sprintf('%d%03d', $parts[1], $parts[0] * 1000);
- }
|