Time::inMillis()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace TraderInteractive\Util;
4
5
/**
6
 * Static class for time based functions.
7
 */
8
final class Time
9
{
10
    /**
11
     * Converts unix timestamp into an ansi sql timestamp literal
12
     *
13
     * @param int $unixTimestamp
14
     *
15
     * @return string ansi sql timestamp surrounded with parenthesis
16
     */
17
    public static function getAnsiSqlTimestamp(int $unixTimestamp) : string
18
    {
19
        return "(TIMESTAMP'" . date('Y-m-d H:i:s', $unixTimestamp) . "')";
20
    }
21
22
    /**
23
     * Get current unix time in milliseconds
24
     *
25
     * @return int the current unix time
26
     */
27
    public static function inMillis() : int
28
    {
29
        return (int)(microtime(true) * 1000);
30
    }
31
}
32