]> git.saurik.com Git - apple/libc.git/blame - gen/FreeBSD/time.c.patch
Libc-594.1.4.tar.gz
[apple/libc.git] / gen / FreeBSD / time.c.patch
CommitLineData
b5d655f7
A
1--- time.c.orig 2008-07-30 13:29:30.000000000 -0700
2+++ time.c 2008-07-30 13:36:03.000000000 -0700
3@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/tim
224c7076
A
4
5 #include <sys/types.h>
6 #include <sys/time.h>
7+#include <fenv.h>
8
9 time_t
10 time(t)
b5d655f7 11@@ -46,12 +47,21 @@ time(t)
224c7076
A
12 {
13 struct timeval tt;
14 time_t retval;
b5d655f7 15+#ifdef FE_DFL_ENV
224c7076 16+ fenv_t fenv;
b5d655f7 17+#endif /* FE_DFL_ENV */
224c7076 18
b5d655f7 19+#ifdef FE_DFL_ENV
224c7076 20+ fegetenv(&fenv); /* 3965505 - need to preserve floating point enviroment */
b5d655f7 21+#endif /* FE_DFL_ENV */
224c7076
A
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;
b5d655f7 28+#ifdef FE_DFL_ENV
224c7076 29+ fesetenv(&fenv);
b5d655f7 30+#endif /* FE_DFL_ENV */
224c7076
A
31 return (retval);
32 }