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)
| 4108 | // It attempts to read the objects mtime and if that isn't present the |
| 4109 | // LastModified returned in the http headers |
| 4110 | func (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 |
| 4134 | func (o *Object) SetModTime(ctx context.Context, modTime time.Time) error { |
nothing calls this directly
no test coverage detected