1
0
mirror of https://github.com/dovecot/core.git synced 2026-10-23 22:08:58 +03:00

global: Drop TIME_T_SIGNED define

This commit is contained in:
Aki Tuomi
2026-07-24 10:22:14 +00:00
parent 7cedd93c4e
commit 00a26d6124
5 changed files with 3 additions and 18 deletions

View 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

View 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.

View 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 },

View 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 },

View 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);