Tomi Ollila <tomi.ollila@iki.fi> writes: >> +static int >> +_cmpmsg (const void *pa, const void *pb) >> +{ >> + notmuch_message_t **a = (notmuch_message_t **) pa; >> + notmuch_message_t **b = (notmuch_message_t **) pb; >> + time_t time_a = notmuch_message_get_date (*a); >> + time_t time_b = notmuch_message_get_date (*b); >> + >> + return (int) difftime (time_a, time_b); > > time_t is often 64 bits now (and I suspect signed). int is often 32-bits > (gcc -dM -E -xc /dev/null | grep -i size to verify), perhaps time_t as > return value ? > The return type is defined as int by the qsort prototype. What we care about here is the sign. I think it's better to just avoid difftime - return (int) difftime (time_a, time_b); + if (time_a == time_b) + return 0; + else if (time_a < time_b) + return -1; + else + return 1; } _______________________________________________ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch