Looks fine. Except the argument to localtime() needs to be &now, and not &tmp. Should we be checking for timezone? Otherwise I would be five hours off because I'm on Eastern US time and localtime() returns GMT.
Also, on Win32, we may wish to use _localtime64(), so we can handle up to December 31, 3000 UTC. I'd hate to commit a change, and have everything break in 2038.
Devin Heitmueller
Senior Software Engineer
Netilla Networks Inc
Quoting Guy Harris <guy@xxxxxxxxxx>:
> On Tue, Apr 01, 2003 at 12:29:32AM -0500, dheitmueller wrote:
> > Attached is a patch to add support for RFC 3514.
>
> To support older IP implementations, perhaps there should be a
> configurable option for that - or perhaps it should just do
>
> time_t now;
> struct tm *tmp;
>
> now = time(NULL);
> tmp = localtime(&tmp);
> if (tmp->tm_mon == 3 && tmp->tm_mday == 1)
> do the new decoding
> else
> do the old decoding
>