]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Drop TIME_T_SIGNED define
authorAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 24 Jul 2026 10:22:14 +0000 (10:22 +0000)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 24 Jul 2026 15:18:31 +0000 (18:18 +0300)
m4/time_t.m4
src/lib-imap/imap-date.c
src/lib-mail/test-message-date.c
src/lib/test-utc-mktime.c
src/lib/utc-mktime.c

index 2d08cf872f7a0fd2c4bf0fa2cc93628c27c295b0..d3fbbfc48300e12ec005fec4f7b2f3603d0c5841 100644 (file)
@@ -20,7 +20,6 @@ AC_DEFUN([DOVECOT_TIME_T], [
       AC_MSG_ERROR([Unsupported time_t type])
       ;;
   esac
-  AC_DEFINE(TIME_T_SIGNED,, [Define if your time_t is signed])
   timet_d_fmt="$timet_len"d
   timet_x_fmt="$timet_len"x
 
index c8200c44c816f14a9d9ccd669875ea580cdd756a..e6827aad525e5b49e5f99565c5ffb803112e7e8e 100644 (file)
@@ -119,11 +119,7 @@ static int imap_mktime(struct tm *tm, time_t *time_r)
        if (tm->tm_year <= 100) {
                /* too old. time_t can be signed or unsigned, handle
                   both cases. */
-#ifdef TIME_T_SIGNED
                *time_r = INT_MIN;
-#else
-               *time_r = 0;
-#endif
                return 0;
        } else if (tm_is_too_large(tm, time_r)) {
                /* too high. return the highest allowed value.
index 0c98d194f6149add829f449d5ee7410230454b1e..2b581d745dad7a9874a08345604372a1cebea3db 100644 (file)
@@ -14,11 +14,9 @@ struct test_message_date {
 static void test_message_date_parse(void)
 {
        static const struct test_message_date tests[] = {
-#ifdef TIME_T_SIGNED
                { "Thu, 01 Jan 1970 01:59:59 +0200", -1, 2*60, TRUE },
                { "Fri, 13 Dec 1901 20:45:53 +0000", -2147483647, 0, TRUE },
-#endif
-#if (TIME_T_MAX_BITS > 32 || !defined(TIME_T_SIGNED))
+#if TIME_T_MAX_BITS > 32
                { "Sun, 07 Feb 2106 06:28:15 +0000", 4294967295U, 0, TRUE },
 #endif
                { "Wed, 07 Nov 2007 01:07:20 +0200", 1194390440, 2*60, TRUE },
index 67b2b482f438900a8a55eb994a049283e69c0a02..5de60fbfbbb12e1ad42c2c5ad7e30f4f1c8fe7a8 100644 (file)
@@ -11,20 +11,16 @@ struct test_utc_mktime {
 void test_utc_mktime(void)
 {
        static const struct test_utc_mktime tests[] = {
-#ifdef TIME_T_SIGNED
                { 1969, 12, 31, 23, 59, 59, -1 },
                { 1901, 12, 13, 20, 45, 53, -2147483647 },
-#endif
-#if (TIME_T_MAX_BITS > 32 || !defined(TIME_T_SIGNED))
-               { 2106, 2, 7, 6, 28, 15, 4294967295 },
-               { 2038, 1, 19, 3, 14, 8, 2147483648 },
-#endif
                { 2007, 11, 7, 1, 7, 20, 1194397640 },
                { 1970, 1, 1, 0, 0, 0, 0 },
                { 2038, 1, 19, 3, 14, 7, 2147483647 },
                { INT_MAX, INT_MAX, INT_MAX, INT_MAX, INT_MAX, INT_MAX, -1 },
 #if TIME_T_MAX_BITS > 32
+               { 2106, 2, 7, 6, 28, 15, 4294967295 },
                { 2106, 2, 7, 6, 28, 16, 4294967296 },
+               { 2038, 1, 19, 3, 14, 8, 2147483648 },
 #endif
                /* June leap second */
                { 2015, 6, 30, 23, 59, 59, 1435708799 },
index 62c71e15fbf8ce8819eea45568af61aad846586c..66863cd147df9438c578902dcacc28cf6d3afab3 100644 (file)
@@ -55,11 +55,7 @@ time_t utc_mktime(const struct tm *tm)
           when gmtime()'s output matches the tm parameter, we've found the
           correct time_t value. this also means that if tm contains invalid
           values, -1 is returned. */
-#ifdef TIME_T_SIGNED
        t = 0;
-#else
-       t = (time_t)1 << (TIME_T_MAX_BITS - 1);
-#endif
        for (bits = TIME_T_MAX_BITS - 2;; bits--) {
                try_tm = gmtime(&t);
                dir = tm_cmp(&leap_adj_tm, try_tm);