]> git.saurik.com Git - apple/libc.git/blob - gen/FreeBSD/time.c.patch
0e5a6e64f93d1b2bb47f5a286d63fc8dac1913f5
[apple/libc.git] / gen / FreeBSD / time.c.patch
1 --- time.c.orig 2009-11-07 14:51:38.000000000 -0800
2 +++ time.c 2009-11-07 14:51:40.000000000 -0800
3 @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/tim
4
5 #include <sys/types.h>
6 #include <sys/time.h>
7 +#include <fenv.h>
8
9 time_t
10 time(t)
11 @@ -42,12 +43,21 @@ time(t)
12 {
13 struct timeval tt;
14 time_t retval;
15 +#ifdef FE_DFL_ENV
16 + fenv_t fenv;
17 +#endif /* FE_DFL_ENV */
18
19 +#ifdef FE_DFL_ENV
20 + fegetenv(&fenv); /* 3965505 - need to preserve floating point enviroment */
21 +#endif /* FE_DFL_ENV */
22 if (gettimeofday(&tt, (struct timezone *)0) < 0)
23 retval = -1;
24 else
25 retval = tt.tv_sec;
26 if (t != NULL)
27 *t = retval;
28 +#ifdef FE_DFL_ENV
29 + fesetenv(&fenv);
30 +#endif /* FE_DFL_ENV */
31 return (retval);
32 }