From 058ece86d245e1606a26214915afef7c54af4cdf Mon Sep 17 00:00:00 2001 From: root Date: Thu, 15 Dec 2022 14:36:53 -0800 Subject: [PATCH] more nits --- weed/shell/command_fs_meta_snapshots_create.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/weed/shell/command_fs_meta_snapshots_create.go b/weed/shell/command_fs_meta_snapshots_create.go index bccff2230..9cf1c3a75 100644 --- a/weed/shell/command_fs_meta_snapshots_create.go +++ b/weed/shell/command_fs_meta_snapshots_create.go @@ -187,11 +187,16 @@ func (c *commandFsMetaSnapshotsCreate) Do(args []string, commandEnv *CommandEnv, if err = fsMetaSnapshotsCreateCommand.Parse(args); err != nil { return err } - snapshotdate := time.Now().AddDate(0, 0, -1) + yesterday := time.Now().Add(-time.Hour * 24).Format(DateFormat) + // ensure snapshot start at yesterday 00:00 + snapshotDate, err := time.Parse(DateFormat, yesterday) + if err != nil { + return err + } var snapshotCheckPoints []time.Time for i := 0; i < *snapshotCnt; i++ { - snapshotCheckPoints = append(snapshotCheckPoints, snapshotdate) - snapshotdate = snapshotdate.AddDate(0, 0, -1**snapshotInterval) + snapshotCheckPoints = append(snapshotCheckPoints, snapshotDate) + snapshotDate = snapshotDate.AddDate(0, 0, -1**snapshotInterval) } homeDirname, err := os.UserHomeDir() if err != nil {