From dedd81180661b8192f9218521e20ce70003bc0f4 Mon Sep 17 00:00:00 2001 From: "sgjesse@chromium.org" Date: Thu, 26 Mar 2009 09:43:14 +0000 Subject: [PATCH] Set svn:eol-style for platform-posix.cc to native. The svn:eol-style property for platform-posix.cc is now set to native. This should get rid of the CR characters in the file added by comitting from Windows and make file lint again. TBR=erik.corry@gmail.com Review URL: http://codereview.chromium.org/42639 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1617 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/platform-posix.cc | 104 +++++++++++++++++++++++++------------------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/src/platform-posix.cc b/src/platform-posix.cc index 87087e4..1cd92b2 100644 --- a/src/platform-posix.cc +++ b/src/platform-posix.cc @@ -34,8 +34,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -54,56 +54,56 @@ namespace v8 { namespace internal { // POSIX date/time support. // -int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { - struct rusage usage; - - if (getrusage(RUSAGE_SELF, &usage) < 0) return -1; - *secs = usage.ru_utime.tv_sec; - *usecs = usage.ru_utime.tv_usec; - return 0; -} - - -double OS::TimeCurrentMillis() { - struct timeval tv; - if (gettimeofday(&tv, NULL) < 0) return 0.0; - return (static_cast(tv.tv_sec) * 1000) + - (static_cast(tv.tv_usec) / 1000); -} - - -int64_t OS::Ticks() { - // gettimeofday has microsecond resolution. - struct timeval tv; - if (gettimeofday(&tv, NULL) < 0) - return 0; - return (static_cast(tv.tv_sec) * 1000000) + tv.tv_usec; -} - - -char* OS::LocalTimezone(double time) { - time_t tv = static_cast(floor(time/msPerSecond)); - struct tm* t = localtime(&tv); - return const_cast(t->tm_zone); -} - - -double OS::DaylightSavingsOffset(double time) { - time_t tv = static_cast(floor(time/msPerSecond)); - struct tm* t = localtime(&tv); - return t->tm_isdst > 0 ? 3600 * msPerSecond : 0; -} - - -double OS::LocalTimeOffset() { - time_t tv = time(NULL); - struct tm* t = localtime(&tv); - // tm_gmtoff includes any daylight savings offset, so subtract it. - return static_cast(t->tm_gmtoff * msPerSecond - - (t->tm_isdst > 0 ? 3600 * msPerSecond : 0)); -} - - +int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { + struct rusage usage; + + if (getrusage(RUSAGE_SELF, &usage) < 0) return -1; + *secs = usage.ru_utime.tv_sec; + *usecs = usage.ru_utime.tv_usec; + return 0; +} + + +double OS::TimeCurrentMillis() { + struct timeval tv; + if (gettimeofday(&tv, NULL) < 0) return 0.0; + return (static_cast(tv.tv_sec) * 1000) + + (static_cast(tv.tv_usec) / 1000); +} + + +int64_t OS::Ticks() { + // gettimeofday has microsecond resolution. + struct timeval tv; + if (gettimeofday(&tv, NULL) < 0) + return 0; + return (static_cast(tv.tv_sec) * 1000000) + tv.tv_usec; +} + + +char* OS::LocalTimezone(double time) { + time_t tv = static_cast(floor(time/msPerSecond)); + struct tm* t = localtime(&tv); + return const_cast(t->tm_zone); +} + + +double OS::DaylightSavingsOffset(double time) { + time_t tv = static_cast(floor(time/msPerSecond)); + struct tm* t = localtime(&tv); + return t->tm_isdst > 0 ? 3600 * msPerSecond : 0; +} + + +double OS::LocalTimeOffset() { + time_t tv = time(NULL); + struct tm* t = localtime(&tv); + // tm_gmtoff includes any daylight savings offset, so subtract it. + return static_cast(t->tm_gmtoff * msPerSecond - + (t->tm_isdst > 0 ? 3600 * msPerSecond : 0)); +} + + // ---------------------------------------------------------------------------- // POSIX socket support. // -- 2.7.4