[llvm-commits] CVS: llvm/lib/System/Unix/TimeValue.inc
Reid Spencer
reid at x10sys.com
Tue Aug 22 10:39:00 PDT 2006
Changes in directory llvm/lib/System/Unix:
TimeValue.inc updated: 1.9 -> 1.10
---
Log message:
Don't throw needlessly. Failure of gettimeofday is *very* unlinkely so
just return MinTime if that should ever happen.
---
Diffs of the changes: (+7 -2)
TimeValue.inc | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
Index: llvm/lib/System/Unix/TimeValue.inc
diff -u llvm/lib/System/Unix/TimeValue.inc:1.9 llvm/lib/System/Unix/TimeValue.inc:1.10
--- llvm/lib/System/Unix/TimeValue.inc:1.9 Mon May 16 01:59:53 2005
+++ llvm/lib/System/Unix/TimeValue.inc Tue Aug 22 12:38:44 2006
@@ -39,8 +39,13 @@
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 ),
More information about the llvm-commits
mailing list