aboutsummaryrefslogtreecommitdiffstats
path: root/lib/System/Unix
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-08-22 17:38:44 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-08-22 17:38:44 +0000
commitd8509c95b874bcfe117bbb852ed4335f46d9db77 (patch)
tree72787483b8bf452ef778e98d38dad7adfa534a86 /lib/System/Unix
parent9a2b7c91cbef0578ac3dd92520bd3c7b02f018af (diff)
downloadexternal_llvm-d8509c95b874bcfe117bbb852ed4335f46d9db77.zip
external_llvm-d8509c95b874bcfe117bbb852ed4335f46d9db77.tar.gz
external_llvm-d8509c95b874bcfe117bbb852ed4335f46d9db77.tar.bz2
Don't throw needlessly. Failure of gettimeofday is *very* unlinkely so
just return MinTime if that should ever happen. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29826 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Unix')
-rw-r--r--lib/System/Unix/TimeValue.inc9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/System/Unix/TimeValue.inc b/lib/System/Unix/TimeValue.inc
index 8c8dfcc..77fc9ab 100644
--- a/lib/System/Unix/TimeValue.inc
+++ b/lib/System/Unix/TimeValue.inc
@@ -39,8 +39,13 @@ std::string TimeValue::toString() const {
TimeValue TimeValue::now() {
struct timeval the_time;
timerclear(&the_time);
- if (0 != ::gettimeofday(&the_time,0))
- ThrowErrno("Couldn't obtain time of day");
+ if (0 != ::gettimeofday(&the_time,0)) {
+ // This is *really* unlikely to occur because the only gettimeofday
+ // errors concern the timezone parameter which we're passing in as 0.
+ // In the unlikely case it does happen, just return MinTime, no error
+ // message needed.
+ return MinTime;
+ }
return TimeValue(
static_cast<TimeValue::SecondsType>( the_time.tv_sec ),