[llvm-commits] CVS: llvm-test/MultiSource/Applications/oggenc/oggenc.c
Reid Spencer
reid at x10sys.com
Thu Jan 11 12:18:12 PST 2007
Changes in directory llvm-test/MultiSource/Applications/oggenc:
oggenc.c updated: 1.4 -> 1.5
---
Log message:
Remove time as a source of non-determinism in the output of this program.
---
Diffs of the changes: (+9 -5)
oggenc.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
Index: llvm-test/MultiSource/Applications/oggenc/oggenc.c
diff -u llvm-test/MultiSource/Applications/oggenc/oggenc.c:1.4 llvm-test/MultiSource/Applications/oggenc/oggenc.c:1.5
--- llvm-test/MultiSource/Applications/oggenc/oggenc.c:1.4 Tue Dec 12 12:23:39 2006
+++ llvm-test/MultiSource/Applications/oggenc/oggenc.c Thu Jan 11 14:17:57 2007
@@ -3043,15 +3043,16 @@
void *timer_start(void)
{
time_t *start = malloc(sizeof(time_t));
- time(start);
+ *start = 21;
return (void *)start;
}
double timer_time(void *timer)
{
- time_t now = time(NULL);
+ static time_t now = 42;
time_t start = *((time_t *)timer);
+ now++;
if(now-start)
return (double)(now-start);
else
@@ -3069,16 +3070,19 @@
void *timer_start(void)
{
struct timeval *start = malloc(sizeof(struct timeval));
- gettimeofday(start, NULL);
+ start->tv_sec = 21;
+ // gettimeofday(start, NULL);
+ start->tv_usec = 0;
return (void *)start;
}
double timer_time(void *timer)
{
- struct timeval now;
+ static struct timeval now = { 42, 0 };
struct timeval start = *((struct timeval *)timer);
- gettimeofday(&now, NULL);
+ // gettimeofday(&now, NULL);
+ now.tv_sec++;
return (double)now.tv_sec - (double)start.tv_sec +
((double)now.tv_usec - (double)start.tv_usec)/1000000.0;
More information about the llvm-commits
mailing list