-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtime.go
39 lines (34 loc) · 1.03 KB
/
time.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package phpfuncs
import "time"
// Time - Similar function of time() in PHP.
//
// Original : https://www.php.net/manual/en/function.time.php
//
// Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
func Time() int64 {
return time.Now().Unix()
}
// Now - Similar function of time() in PHP.
//
// Original : https://www.php.net/manual/en/function.time.php
//
// Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
func Now() int64 {
return time.Now().Unix()
}
// Sleep - Delay in seconds
//
// Original : https://www.php.net/manual/en/function.sleep.php
//
// Delays the program execution for the given number of seconds.
func Sleep(t int64) {
time.Sleep(time.Duration(t) * time.Second)
}
// USleep - Delay in microseconds
//
// Original : https://www.php.net/manual/en/function.usleep.php
//
// Delays program execution for the given number of microseconds.
func USleep(t int64) {
time.Sleep(time.Duration(t) * time.Microsecond)
}