Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: runtime/bin/file_win.cc

Issue 252123005: Make FileStat have millisecond precisions, for linux, mac and android. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/file_macos.cc ('k') | sdk/lib/io/file_system_entity.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_WINDOWS) 6 #if defined(TARGET_OS_WINDOWS)
7 7
8 #include "bin/file.h" 8 #include "bin/file.h"
9 9
10 #include <fcntl.h> // NOLINT 10 #include <fcntl.h> // NOLINT
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 free(buffer); 454 free(buffer);
455 free(utf8_target); 455 free(utf8_target);
456 return NULL; 456 return NULL;
457 } 457 }
458 utf8_target[utf8_length] = '\0'; 458 utf8_target[utf8_length] = '\0';
459 free(buffer); 459 free(buffer);
460 return utf8_target; 460 return utf8_target;
461 } 461 }
462 462
463 463
464 static int64_t TimespecToMilliseconds(const struct timespec& t) {
465 return t.tv_sec * 1000 + t.tv_nsec / 1000000;
466 }
467
468
464 void File::Stat(const char* name, int64_t* data) { 469 void File::Stat(const char* name, int64_t* data) {
465 File::Type type = GetType(name, false); 470 File::Type type = GetType(name, false);
466 data[kType] = type; 471 data[kType] = type;
467 if (type != kDoesNotExist) { 472 if (type != kDoesNotExist) {
468 struct _stat64 st; 473 struct _stat64 st;
469 const wchar_t* system_name = StringUtils::Utf8ToWide(name); 474 const wchar_t* system_name = StringUtils::Utf8ToWide(name);
470 int stat_status = _wstat64(system_name, &st); 475 int stat_status = _wstat64(system_name, &st);
471 free(const_cast<wchar_t*>(system_name)); 476 free(const_cast<wchar_t*>(system_name));
472 if (stat_status == 0) { 477 if (stat_status == 0) {
473 data[kCreatedTime] = st.st_ctime; 478 data[kCreatedTime] = st.st_ctime * 1000;
474 data[kModifiedTime] = st.st_mtime; 479 data[kModifiedTime] = st.st_mtime * 1000;
475 data[kAccessedTime] = st.st_atime; 480 data[kAccessedTime] = st.st_atime * 1000;
476 data[kMode] = st.st_mode; 481 data[kMode] = st.st_mode;
477 data[kSize] = st.st_size; 482 data[kSize] = st.st_size;
478 } else { 483 } else {
479 data[kType] = File::kDoesNotExist; 484 data[kType] = File::kDoesNotExist;
480 } 485 }
481 } 486 }
482 } 487 }
483 488
484 489
485 time_t File::LastModified(const char* name) { 490 time_t File::LastModified(const char* name) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 return kIdentical; 646 return kIdentical;
642 } else { 647 } else {
643 return kDifferent; 648 return kDifferent;
644 } 649 }
645 } 650 }
646 651
647 } // namespace bin 652 } // namespace bin
648 } // namespace dart 653 } // namespace dart
649 654
650 #endif // defined(TARGET_OS_WINDOWS) 655 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « runtime/bin/file_macos.cc ('k') | sdk/lib/io/file_system_entity.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698