[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: x32 "half"arrived... now what?



Kurt Roeckx dixit:

>tm_year should be an int, not a time_t or long.  Note that it

POSIX says it “must” be a long…

>counts in years, and so even a 16 bit int isn't going to cause
>much problems for tm_year.

… but I disagree. All time_t seconds-since-the-epoch values
need (in practice) to round-trip through “struct tm”, which
requires tm_year to be of a type of the magnitude time_t has:

tg@blau:~ $ cat x.c
#include <limits.h>
#include <stdio.h>
#include <time.h>
int main(void) { struct tm *tm; time_t tmax = LLONG_MAX; tm = gmtime(&tmax); printf("%lld\n", (long long)tm->tm_year); return (0); }
tg@blau:~ $ ./a.out
292277024696

This (0x44.0D11.77B8) doesn’t fit into 32 bits any more.

bye,
//mirabilos
-- 
17:08⎜«Vutral» früher gabs keine packenden smartphones und so
17:08⎜«Vutral» heute gibts frauen die sind facebooksüchtig
17:10⎜«Vutral» aber auch traurig; früher warst du als nerd voll am arsch
17:10⎜«Vutral» heute bist du als nerd der einzige der wirklich damit klarkommt


Reply to: