File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,7 +39,8 @@ describe('fileDatesEqual', () => {
3939 } ) ;
4040
4141 test ( 'Different dates differ' , ( ) => {
42- expect ( fileDatesEqual ( new Date ( 1491393798834 ) , new Date ( 1491393798835 ) ) ) . toBeFalsy ( ) ;
42+ expect ( fileDatesEqual ( new Date ( 1491393798834 ) , new Date ( 1491393798835 ) ) ) . toBeTruthy ( ) ;
43+ expect ( fileDatesEqual ( new Date ( 1491393798834 ) , new Date ( 1491393798836 ) ) ) . toBeFalsy ( ) ;
4344 expect ( fileDatesEqual ( new Date ( 1491393700834 ) , new Date ( 1491393798834 ) ) ) . toBeFalsy ( ) ;
4445 } ) ;
4546
Original file line number Diff line number Diff line change @@ -88,6 +88,14 @@ export const fileDatesEqual = (a: Date, b: Date) => {
8888 return aTime === bTime ;
8989 }
9090
91+ // See https://github.com/nodejs/node/pull/12607
92+ // Submillisecond times from stat and utimes are truncated on Windows,
93+ // causing a file with mtime 8.0079998 and 8.0081144 to become 8.007 and 8.008
94+ // and making it impossible to update these files to their correct timestamps.
95+ if ( Math . abs ( aTime - bTime ) <= 1 ) {
96+ return true ;
97+ }
98+
9199 const aTimeSec = Math . floor ( aTime / 1000 ) ;
92100 const bTimeSec = Math . floor ( bTime / 1000 ) ;
93101
You can’t perform that action at this time.
0 commit comments