ModTime returns the modification time of the object It attempts to read the objects mtime and if that isn't present the LastModified returned to the http headers
(ctx context.Context)
| 271 | // It attempts to read the objects mtime and if that isn't present the |
| 272 | // LastModified returned to the http headers |
| 273 | func (o *Object) ModTime(ctx context.Context) (result time.Time) { |
| 274 | if o.fs.ci.UseServerModTime { |
| 275 | return o.lastModified |
| 276 | } |
| 277 | err := o.readMetaData(ctx) |
| 278 | if err != nil { |
| 279 | fs.Logf(o, "Failed to read metadata: %v", err) |
| 280 | return time.Now() |
| 281 | } |
| 282 | // read mtime out of metadata if available |
| 283 | d, ok := o.meta[metaMtime] |
| 284 | if !ok || d == "" { |
| 285 | return o.lastModified |
| 286 | } |
| 287 | modTime, err := swift.FloatStringToTime(d) |
| 288 | if err != nil { |
| 289 | fs.Logf(o, "Failed to read mtime from object: %v", err) |
| 290 | return o.lastModified |
| 291 | } |
| 292 | return modTime |
| 293 | } |
| 294 | |
| 295 | // SetModTime sets the modification time of the local fs object |
| 296 | func (o *Object) SetModTime(ctx context.Context, modTime time.Time) error { |
nothing calls this directly
no test coverage detected