1: <?php
2: namespace phpcassa\Util;
3:
4: /**
5: * A clock that can provide microsecond precision.
6: *
7: * @package phpcassa\Util
8: */
9: class Clock {
10:
11: /**
12: * Get a timestamp with microsecond precision
13: */
14: static public function get_time() {
15: // By Zach Buller (zachbuller@gmail.com)
16: $time1 = \microtime();
17: \settype($time1, 'string'); //convert to string to keep trailing zeroes
18: $time2 = explode(" ", $time1);
19: $sub_secs = \preg_replace('/0./', '', $time2[0], 1);
20: $time3 = ($time2[1].$sub_secs)/100;
21: return $time3;
22: }
23: }
24: