forked from TencentBlueKing/blueking-dbm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(mysql): 闪回修复时间格式,mydumper增加lock-wait-timeout TencentBlueKing#8632
- Loading branch information
Showing
8 changed files
with
66 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,26 @@ | ||
package cmutil | ||
|
||
import "time" | ||
import ( | ||
"time" | ||
|
||
"github.com/pkg/errors" | ||
) | ||
|
||
// TimeToSecondPrecision keep only second precision for time | ||
func TimeToSecondPrecision(t time.Time) time.Time { | ||
timeStr := t.Local().Format(time.RFC3339) | ||
tt, _ := time.ParseInLocation(time.RFC3339, timeStr, time.Local) | ||
return tt | ||
} | ||
|
||
// ParseLocalTimeString 讲 time.Datetime or time.RFC3339 格式转换传本地时区 time.Time 类型 | ||
func ParseLocalTimeString(s string) (time.Time, error) { | ||
t, err := time.ParseInLocation(time.DateTime, s, time.Local) | ||
if err != nil { | ||
if t, err = time.ParseInLocation(time.RFC3339, s, time.Local); err != nil { | ||
return time.Time{}, | ||
errors.Errorf("expect time format '%s' or '%s' but got '%s'", time.DateTime, time.RFC3339, s) | ||
} | ||
} | ||
return t, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters