This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 1/2] Y2038: Add 64-bit time for all architectures


On 06/14/2018 06:51 AM, Albert ARIBAUD (3ADEV) wrote:
+/* check whether a time64_t value fits in a time_t */
+# if __TIMESIZE == 64
+/* __time64_t is time_t, so it always fits_in_time_t */
+#  define fits_in_time_t(x)	1
+# else
+/* Not all __time64_t values can fit; check by type-casting */
+static inline bool
+fits_in_time_t (__time64_t t)
+{
+  return t == (time_t) t;
+}
+# endif

Don't bother with the "#if". Just have the static function unconditionally. It should generate zero instructions if time_t is 64 bits.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]