Subject: Re: HEADS UP! New generic TODR support committed
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
From: Garrett D'Amore <garrett_damore@tadpole.com>
List: tech-kern
Date: 09/03/2006 10:10:03
Izumi Tsutsui wrote:
> garrett_damore@tadpole.com wrote:
>
>
>> We had this debate already.
>>
>
> Hmm, I was AFK in this weekend so missed it, but okay,
> it's better to make all port switched ASAP rather than
> discussing how we should make transition.
>
> I'll work on arc, hp300, newsmips, and news68k.
> (maybe mvme68k, mvmeppc, prep could switch easily)
>
>
>>>>> base = 21*SECYR + 186*SECDAY + SECDAY/2;
>>>>>
>>> BTW, shouldn't this default date be at least "today"?
>>>
>> Yes, it should probably be updated. I can take a look at that. :-) I
>> copied that date from some other code. :-)
>>
>
> I always wondered how we could update this date ;-)
> but we should note what date it means...
>
> It's hard to see "21 = 1991 - POSIX_BASE_YEAR" and
> "186=31+28+31+30+31+30+5(leap years since 1970)" etc.
> and some ports (including one written by me) misuse "186" ;-)
>
How about this:
struct clock_ymdhms basedate;
/*
* If base is 0, assume filesystem time is just unknown
* instead of preposterous. Don't bark.
*/
if (base != 0)
printf("WARNING: preposterous time in file system\n");
/* not going to use it anyway, if the chip is readable */
basedate.dt_year = 2006;
basedate.dt_mon = 1;
basedate.dt_day = 1;
basedate.dt_hour = 12;
basedate.dt_min = 0;
basedate.dt_sec = 0;
base = clock_ymdhms_to_secs(&basedate);
That should be more readable. (Note I set this to 12pm Jan 1, 2006.)
One could argue that we could automatically set this to some date
derived from the build date -- maybe the build time - 1 month or somesuch.
-- Garrett
> ---
> Izumi Tsutsui
>
--
Garrett D'Amore, Principal Software Engineer
Tadpole Computer / Computing Technologies Division,
General Dynamics C4 Systems
http://www.tadpolecomputer.com/
Phone: 951 325-2134 Fax: 951 325-2191