MCPcopy Index your code
hub / github.com/rclone/rclone / ModTime

Method ModTime

backend/s3/s3.go:4110–4131  ·  view source on GitHub ↗

ModTime returns the modification time of the object It attempts to read the objects mtime and if that isn't present the LastModified returned in the http headers

(ctx context.Context)

Source from the content-addressed store, hash-verified

4108// It attempts to read the objects mtime and if that isn't present the
4109// LastModified returned in the http headers
4110func (o *Object) ModTime(ctx context.Context) time.Time {
4111 if o.fs.ci.UseServerModTime {
4112 return o.lastModified
4113 }
4114 err := o.readMetaData(ctx)
4115 if err != nil {
4116 fs.Logf(o, "Failed to read metadata: %v", err)
4117 return time.Now()
4118 }
4119 // read mtime out of metadata if available
4120 d, ok := o.meta[metaMtime]
4121 if !ok {
4122 // fs.Debugf(o, "No metadata")
4123 return o.lastModified
4124 }
4125 modTime, err := swift.FloatStringToTime(d)
4126 if err != nil {
4127 fs.Logf(o, "Failed to read mtime from object: %v", err)
4128 return o.lastModified
4129 }
4130 return modTime
4131}
4132
4133// SetModTime sets the modification time of the local fs object
4134func (o *Object) SetModTime(ctx context.Context, modTime time.Time) error {

Callers

nothing calls this directly

Calls 2

readMetaDataMethod · 0.95
LogfFunction · 0.92

Tested by

no test coverage detected