Browse code

reuse timestamp, don't call time.Now() 3 times

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)

unclejack authored on 2014/05/31 09:03:51
Showing 1 changed files
... ...
@@ -352,12 +352,13 @@ func ExportChanges(dir string, changes []Change) (Archive, error) {
352 352
 				whiteOutDir := filepath.Dir(change.Path)
353 353
 				whiteOutBase := filepath.Base(change.Path)
354 354
 				whiteOut := filepath.Join(whiteOutDir, ".wh."+whiteOutBase)
355
+				timestamp := time.Now()
355 356
 				hdr := &tar.Header{
356 357
 					Name:       whiteOut[1:],
357 358
 					Size:       0,
358
-					ModTime:    time.Now(),
359
-					AccessTime: time.Now(),
360
-					ChangeTime: time.Now(),
359
+					ModTime:    timestamp,
360
+					AccessTime: timestamp,
361
+					ChangeTime: timestamp,
361 362
 				}
362 363
 				if err := tw.WriteHeader(hdr); err != nil {
363 364
 					utils.Debugf("Can't write whiteout header: %s\n", err)