@@ -5,6 +5,7 @@ package platform
55
66import (
77 "io/ioutil"
8+ "log"
89 "os/exec"
910 "time"
1011)
@@ -16,9 +17,6 @@ const (
1617
1718 // CNIRuntimePath is the path where CNM state files are stored.
1819 CNIRuntimePath = "/var/run/"
19-
20- // LogPath is the path where log files are stored.
21- LogPath = "/var/log/"
2220)
2321
2422// GetOSInfo returns OS version information.
@@ -36,19 +34,19 @@ func GetLastRebootTime() (time.Time, error) {
3634 // Query last reboot time.
3735 out , err := exec .Command ("uptime" , "-s" ).Output ()
3836 if err != nil {
39- // log.Printf("Failed to query uptime, err:%v", err)
40- return time.Time {}, err
37+ log .Printf ("Failed to query uptime, err:%v" , err )
38+ return time.Time {}. UTC () , err
4139 }
4240
4341 // Parse the output.
4442 layout := "2006-01-02 15:04:05"
45- rebootTime , err := time .Parse (layout , string (out [:len (out )- 1 ]))
43+ rebootTime , err := time .ParseInLocation (layout , string (out [:len (out )- 1 ]), time . Local )
4644 if err != nil {
47- // log.Printf("Failed to parse uptime, err:%v", err)
48- return time.Time {}, err
45+ log .Printf ("Failed to parse uptime, err:%v" , err )
46+ return time.Time {}. UTC () , err
4947 }
5048
51- return rebootTime , nil
49+ return rebootTime . UTC () , nil
5250}
5351
5452// ExecuteShellCommand executes a shell command.
0 commit comments