Skip to content

Commit

Permalink
fix(189pc): wrong time if location incorrect (close #1562)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Sep 8, 2022
1 parent 918ca28 commit fbaebc0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion drivers/189pc/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ func timestamp() int64 {
}

func MustParseTime(str string) *time.Time {
lastOpTime, _ := time.ParseInLocation("2006-01-02 15:04:05", str, time.Local)
loc, _ := time.LoadLocation("Asia/Shanghai")
lastOpTime, _ := time.ParseInLocation("2006-01-02 15:04:05", str, loc)
return &lastOpTime
}

Expand Down
3 changes: 1 addition & 2 deletions pkg/utils/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package utils

import (
"io"
"io/ioutil"
"os"
"path/filepath"

Expand Down Expand Up @@ -35,7 +34,7 @@ func CreateNestedFile(path string) (*os.File, error) {

// CreateTempFile create temp file from io.ReadCloser, and seek to 0
func CreateTempFile(r io.ReadCloser) (*os.File, error) {
f, err := ioutil.TempFile(conf.Conf.TempDir, "file-*")
f, err := os.CreateTemp(conf.Conf.TempDir, "file-*")
if err != nil {
return nil, err
}
Expand Down

0 comments on commit fbaebc0

Please sign in to comment.