log watcher is done
This commit is contained in:
@@ -203,3 +203,12 @@ func TimeToUnix(timeStr string, layout string) (int64, error) {
|
||||
// 转 11 位时间戳(秒)
|
||||
return t.Unix(), nil
|
||||
}
|
||||
func ParseCustomTime(s string) (CustomTime, error) {
|
||||
ct := CustomTime{}
|
||||
// UnmarshalJSON 需要带双引号的json字符串,所以包装成json字符串格式
|
||||
err := ct.UnmarshalJSON([]byte(`"` + s + `"`))
|
||||
if err != nil {
|
||||
return CustomTime{}, err
|
||||
}
|
||||
return ct, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user