summaryrefslogtreecommitdiff
path: root/lib/libc/stdtime/time32.c
diff options
context:
space:
mode:
authorMatthew Dillon <dillon@FreeBSD.org>2001-10-28 20:13:16 +0000
committerMatthew Dillon <dillon@FreeBSD.org>2001-10-28 20:13:16 +0000
commite8627df69dc353e5db872d631d2b73001679f649 (patch)
tree1ed18984204d465714c14b43e94e4f3ac5eba93c /lib/libc/stdtime/time32.c
parent5b3817c60b5d4e7ac21b4576f820cad7e853b5d9 (diff)
Notes
Diffstat (limited to 'lib/libc/stdtime/time32.c')
-rw-r--r--lib/libc/stdtime/time32.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/libc/stdtime/time32.c b/lib/libc/stdtime/time32.c
index 4886f7c036a5..ed3d3e0ced56 100644
--- a/lib/libc/stdtime/time32.c
+++ b/lib/libc/stdtime/time32.c
@@ -58,3 +58,43 @@ time_to_time64(time_t t)
return((__int64_t)t);
}
+/*
+ * Convert to/from 'long'. Depending on the sizeof(long) this may or
+ * may not require using the 50-year rule.
+ */
+long
+time_to_long(time_t t)
+{
+ if (sizeof(long) == sizeof(__int64_t))
+ return(time_to_time64(t));
+ return((long)t);
+}
+
+time_t
+long_to_time(long tlong)
+{
+ if (sizeof(long) == sizeof(__int32_t))
+ return(time32_to_time(tlong));
+ return((time_t)tlong);
+}
+
+/*
+ * Convert to/from 'int'. Depending on the sizeof(int) this may or
+ * may not require using the 50-year rule.
+ */
+int
+time_to_int(time_t t)
+{
+ if (sizeof(int) == sizeof(__int64_t))
+ return(time_to_time64(t));
+ return((int)t);
+}
+
+time_t
+int_to_time(int tint)
+{
+ if (sizeof(int) == sizeof(__int32_t))
+ return(time32_to_time(tint));
+ return((time_t)tint);
+}
+