Skip to content
Browse files

Allow 64-bit timestamps to be set on 64-bit kernels

  • Loading branch information...
1 parent e05bec8 commit b399efcda849f1c4308c832af948cb92f6cece6a @chrisrd committed Dec 6, 2011
Showing with 8 additions and 3 deletions.
  1. +8 −3 include/sys/time.h
View
11 include/sys/time.h
@@ -34,8 +34,13 @@
#include <sys/types.h>
#include <sys/timer.h>
-#define TIME32_MAX INT32_MAX
-#define TIME32_MIN INT32_MIN
+#if defined(CONFIG_64BIT)
+#define TIME_MAX INT64_MAX
+#define TIME_MIN INT64_MIN
+#else
+#define TIME_MAX INT32_MAX
+#define TIME_MIN INT32_MIN
+#endif
#define SEC 1
#define MILLISEC 1000
@@ -83,6 +88,6 @@ gethrestime_sec(void)
}
#define TIMESPEC_OVERFLOW(ts) \
- ((ts)->tv_sec < TIME32_MIN || (ts)->tv_sec > TIME32_MAX)
+ ((ts)->tv_sec < TIME_MIN || (ts)->tv_sec > TIME_MAX)
#endif /* _SPL_TIME_H */

1 comment on commit b399efc

@chrisrd
Owner

ZFS and 64-bit linux are perfectly capable of dealing with 64-bit timestamps,
but zfs deliberately prevents setting them:

# touch -d'2039-01-01' /tank/foo && ls -l /tank/foo
touch: setting times of `/tank/foo': Value too large for defined data type

If spl/include/sys/time.h is changed to avoid this restriction (below), it's
then possible to use 64-bit timestamps:

# touch -d'2039-01-01' /tank/foo && ls -l /tank/foo
-rw-r--r-- 1 root root 0 2039-01-01 00:00 /tank/foo

I note that FreeBSD looks to have already removed the 32-bit
timestamp restriction for 64-bit architectures:

http://lists.freebsd.org/pipermail/svn-src-stable-8/2010-February/001642.html

Please sign in to comment.
Something went wrong with that request. Please try again.