| OLD | NEW |
| 1 // Copyright 2014 The Chromium OS Authors. All rights reserved. | 1 // Copyright 2014 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Converts a c/c++ time_t variable to Date. | 8 * Converts a c/c++ time_t variable to Date. |
| 9 * The time we get from the archive is in local time. |
| 9 * @param {number} timestamp A c/c++ time_t variable. | 10 * @param {number} timestamp A c/c++ time_t variable. |
| 10 * @return {!Date} | 11 * @return {!Date} |
| 11 */ | 12 */ |
| 12 function DateFromTimeT(timestamp) { | 13 function DateFromTimeT(timestamp) { |
| 13 return new Date(1000 * timestamp); | 14 var local = new Date(1000 * timestamp); |
| 15 console.info(local.getHours()) |
| 16 return new Date( local.getTime() + (local.getTimezoneOffset() * 60000)); |
| 14 } | 17 } |
| 15 | 18 |
| 16 /** | 19 /** |
| 17 * Corrects metadata entries fields in order for them to be sent to Files.app. | 20 * Corrects metadata entries fields in order for them to be sent to Files.app. |
| 18 * This function runs recursively for every entry in a directory. | 21 * This function runs recursively for every entry in a directory. |
| 19 * @param {!Object<string, !EntryMetadata>} entryMetadata The metadata to | 22 * @param {!Object<string, !EntryMetadata>} entryMetadata The metadata to |
| 20 * correct. | 23 * correct. |
| 21 */ | 24 */ |
| 22 function correctMetadata(entryMetadata) { | 25 function correctMetadata(entryMetadata) { |
| 23 entryMetadata.index = parseInt(entryMetadata.index, 10); | 26 entryMetadata.index = parseInt(entryMetadata.index, 10); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 var entryMetadata = this.metadata; | 340 var entryMetadata = this.metadata; |
| 338 for (var i = 0, limit = pathArray.length; i < limit; i++) { | 341 for (var i = 0, limit = pathArray.length; i < limit; i++) { |
| 339 if (!entryMetadata || | 342 if (!entryMetadata || |
| 340 !entryMetadata.isDirectory && i != limit - 1 /* Parent directory. */) | 343 !entryMetadata.isDirectory && i != limit - 1 /* Parent directory. */) |
| 341 return null; | 344 return null; |
| 342 entryMetadata = entryMetadata.entries[pathArray[i]]; | 345 entryMetadata = entryMetadata.entries[pathArray[i]]; |
| 343 } | 346 } |
| 344 | 347 |
| 345 return entryMetadata; | 348 return entryMetadata; |
| 346 }; | 349 }; |
| OLD | NEW |