]> khamidou — GitHub mirrors - electron.git/commitdiff
Optimize fs.stat
authorSubash Pathak <sbspk@msn.com>
Thu, 2 Oct 2014 17:50:37 +0000 (23:35 +0545)
committerSubash Pathak <sbspk@msn.com>
Thu, 2 Oct 2014 17:50:37 +0000 (23:35 +0545)
atom/common/lib/asar.coffee

index 694f3b1a1db812dd4d81374b92f459a3fbcabc4d..eb56bb98c26d7e8bd89dc00a5e9c16c9be3655be 100644 (file)
@@ -29,6 +29,7 @@ splitPath = (p) ->
 nextInode = 0
 uid = if process.getuid? then process.getuid() else 0
 gid = if process.getgid? then process.getgid() else 0
+fakeTime = new Date()
 asarStatsToFsStats = (stats) ->
   {
     dev: 1,
@@ -38,10 +39,10 @@ asarStatsToFsStats = (stats) ->
     uid: uid,
     gid: gid,
     rdev: 0,
-    atime: stats.atime || new Date(),
-    birthtime: stats.birthtime || new Date(),
-    mtime: stats.mtime || new Date(),
-    ctime: stats.ctime || new Date(),
+    atime: stats.atime || fakeTime,
+    birthtime: stats.birthtime || fakeTime,
+    mtime: stats.mtime || fakeTime,
+    ctime: stats.ctime || fakeTime,
     size: stats.size,
     isFile: -> stats.isFile
     isDirectory: -> stats.isDirectory