OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 int64_t OS::Ticks() { | 197 int64_t OS::Ticks() { |
198 // gettimeofday has microsecond resolution. | 198 // gettimeofday has microsecond resolution. |
199 struct timeval tv; | 199 struct timeval tv; |
200 if (gettimeofday(&tv, NULL) < 0) | 200 if (gettimeofday(&tv, NULL) < 0) |
201 return 0; | 201 return 0; |
202 return (static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec; | 202 return (static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec; |
203 } | 203 } |
204 | 204 |
205 | 205 |
206 double OS::DaylightSavingsOffset(double time) { | 206 double OS::DaylightSavingsOffset(double time) { |
207 if (isnan(time)) return nan_value(); | 207 if (std::isnan(time)) return nan_value(); |
208 time_t tv = static_cast<time_t>(floor(time/msPerSecond)); | 208 time_t tv = static_cast<time_t>(floor(time/msPerSecond)); |
209 struct tm* t = localtime(&tv); | 209 struct tm* t = localtime(&tv); |
210 if (NULL == t) return nan_value(); | 210 if (NULL == t) return nan_value(); |
211 return t->tm_isdst > 0 ? 3600 * msPerSecond : 0; | 211 return t->tm_isdst > 0 ? 3600 * msPerSecond : 0; |
212 } | 212 } |
213 | 213 |
214 | 214 |
215 int OS::GetLastError() { | 215 int OS::GetLastError() { |
216 return errno; | 216 return errno; |
217 } | 217 } |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 return ntohl(value); | 563 return ntohl(value); |
564 } | 564 } |
565 | 565 |
566 | 566 |
567 Socket* OS::CreateSocket() { | 567 Socket* OS::CreateSocket() { |
568 return new POSIXSocket(); | 568 return new POSIXSocket(); |
569 } | 569 } |
570 | 570 |
571 | 571 |
572 } } // namespace v8::internal | 572 } } // namespace v8::internal |
OLD | NEW |