tech-kern archive

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

Re: Unification of common date/time macros



In article <20140922053054.GB25732%netbsd.org@localhost>,
David Holland  <dholland-tech%netbsd.org@localhost> wrote:
>On Tue, Sep 16, 2014 at 01:37:11AM +0200, Kamil Rytarowski wrote:
> > My proposition is to go for a new file src/sys/sys/clock.h. Normalize
>naming with /usr/include/tzfile.h, then uniformly export the file for
>reuse across the kernel.
> > 
> > #define SECSPERMIN      60L
> > #define MINSPERHOUR     60L
> > #define HOURSPERDAY     24L
> > #define DAYSPERWEEK     7L
> > #define DAYSPERNYEAR    365L
> > #define DAYSPERLYEAR    366L
> > #define SECSPERHOUR     (SECSPERMIN * MINSPERHOUR)
> > #define SECSPERDAY      (SECSPERHOUR * HOURSPERDAY)
> > #define MONSPERYEAR     12L
> > #define EPOCH_YEAR      1970L
> > 
> > + macros/defines of leap-year macro, weak-of-day etc.
> > 
> > Maybe avoid name-clashes with tzfile.h and go for SECSMIN etc.?
> > 
> > What do you think? Is it worth adding?
>
>Probably, but I'd call it sys/calendar.h. It's not really clock stuff,
>in the sense that clock stuff is mostly about ticking seconds.

I would separate words with _ consistently. I don't know if we should be
forcing those contacts to long anyway...

christos




Home | Main Index | Thread Index | Old Index