summaryrefslogtreecommitdiffstats
path: root/llvm/lib/System
diff options
context:
space:
mode:
authorTorok Edwin <edwintorok@gmail.com>2010-01-22 15:51:31 +0000
committerTorok Edwin <edwintorok@gmail.com>2010-01-22 15:51:31 +0000
commitfbcd2c76d52a9b91dc657d16be0e2b101ddc1f59 (patch)
tree488695a6929237b39739766b70ab758e7893420f /llvm/lib/System
parent0599df16a69d42bf5f2c4951712f9011a6dc2610 (diff)
downloadbcm5719-llvm-fbcd2c76d52a9b91dc657d16be0e2b101ddc1f59.tar.gz
bcm5719-llvm-fbcd2c76d52a9b91dc657d16be0e2b101ddc1f59.zip
Fix TimeValue::now() on Unix.
TimeValue()::now().toEpochTime() is supposed to be the same as time(), but it wasn't, because toEpoch subtracted PosixZeroTime, but now() didn't add PosixZeroTime! Add a unittest to check this works. llvm-svn: 94178
Diffstat (limited to 'llvm/lib/System')
-rw-r--r--llvm/lib/System/Unix/TimeValue.inc2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/System/Unix/TimeValue.inc b/llvm/lib/System/Unix/TimeValue.inc
index 1ae8c7184d5..d8cc8f55eec 100644
--- a/llvm/lib/System/Unix/TimeValue.inc
+++ b/llvm/lib/System/Unix/TimeValue.inc
@@ -48,7 +48,7 @@ TimeValue TimeValue::now() {
}
return TimeValue(
- static_cast<TimeValue::SecondsType>( the_time.tv_sec ),
+ static_cast<TimeValue::SecondsType>( the_time.tv_sec + PosixZeroTime.seconds_ ),
static_cast<TimeValue::NanoSecondsType>( the_time.tv_usec *
NANOSECONDS_PER_MICROSECOND ) );
}
OpenPOWER on IntegriCloud