diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-08-22 17:38:44 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-08-22 17:38:44 +0000 |
commit | b1f993540742157a8ea3ab37ec6667175eb837b0 (patch) | |
tree | 0d74dfc1d199e39f07f5aa1541a6c000503051f9 /llvm/lib/System/Unix | |
parent | bcf307a04941126ca49204f95f0e04e9b699c728 (diff) | |
download | bcm5719-llvm-b1f993540742157a8ea3ab37ec6667175eb837b0.tar.gz bcm5719-llvm-b1f993540742157a8ea3ab37ec6667175eb837b0.zip |
Don't throw needlessly. Failure of gettimeofday is *very* unlinkely so
just return MinTime if that should ever happen.
llvm-svn: 29826
Diffstat (limited to 'llvm/lib/System/Unix')
-rw-r--r-- | llvm/lib/System/Unix/TimeValue.inc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/System/Unix/TimeValue.inc b/llvm/lib/System/Unix/TimeValue.inc index 8c8dfcc3b74..77fc9abe527 100644 --- a/llvm/lib/System/Unix/TimeValue.inc +++ b/llvm/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 ), |