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

Bug#548128: Similar Problem

On Friday 11 December 2009, Frans Pop wrote:
> On Friday 11 December 2009, Frans Pop wrote:
> > And that looks to be the issue described in this bug report:
> > http://bugs.debian.org/502336
> I've just done some debugging in rdate of this problem, and it looks to
> be a calculation bug in rdate (either due to incorrect handling of
> overflow or maybe endianness). See the BR linked above for details.

So, if the problem is simply that rdate fails when the current system time 
is before the epoch (1-1-1970), how about we include a trivial command to 
set the date to the epoch before calling rdate as a workaround until rdate 
gets fixed.

The attached code does the job.

 * Copyright (c) 2009 Frans Pop <fjp@debian.org>
 * Licence: GPL version 2 or later

 * set-date-epoch.c: Set the system date to the epoch
#include <sys/time.h>

#include <err.h>
#include <time.h>

main(int argc, char **argv)
	struct timeval new;

	new.tv_sec = 0;
	new.tv_usec = 0;
	if (settimeofday(&new, NULL) == -1)
		err(1, "Could not set time of day");

	return 0;

Reply to: