dropbox: Switch to using RFC3339 for time metadata
This commit is contained in:
parent
7c9bdb4b7a
commit
dfc8a375f6
1 changed files with 4 additions and 3 deletions
|
@ -31,7 +31,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ncw/rclone/fs"
|
"github.com/ncw/rclone/fs"
|
||||||
"github.com/ncw/swift"
|
|
||||||
"github.com/stacktic/dropbox"
|
"github.com/stacktic/dropbox"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -46,6 +45,8 @@ const (
|
||||||
md5sumField = "md5sum"
|
md5sumField = "md5sum"
|
||||||
mtimeField = "mtime"
|
mtimeField = "mtime"
|
||||||
maxCommitRetries = 5
|
maxCommitRetries = 5
|
||||||
|
RFC3339In = time.RFC3339
|
||||||
|
RFC3339Out = "2006-01-02T15:04:05.000000000Z07:00"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Register with Fs
|
// Register with Fs
|
||||||
|
@ -622,7 +623,7 @@ func (o *FsObjectDropbox) readMetaData() (err error) {
|
||||||
if !ok {
|
if !ok {
|
||||||
fs.Debug(o, "mtime not a string")
|
fs.Debug(o, "mtime not a string")
|
||||||
} else {
|
} else {
|
||||||
modTime, err := swift.FloatStringToTime(mtime)
|
modTime, err := time.Parse(RFC3339In, mtime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -668,7 +669,7 @@ func (o *FsObjectDropbox) setModTimeAndMd5sum(modTime time.Time, md5sum string)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !modTime.IsZero() {
|
if !modTime.IsZero() {
|
||||||
mtime := swift.TimeToFloatString(modTime)
|
mtime := modTime.Format(RFC3339Out)
|
||||||
err := record.Set(mtimeField, mtime)
|
err := record.Set(mtimeField, mtime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Couldn't set mtime record: %s", err)
|
return fmt.Errorf("Couldn't set mtime record: %s", err)
|
||||||
|
|
Loading…
Reference in a new issue