NetBSD-Bugs archive

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

Re: kern/49207



Sep 27,  7:20pm, n54%gmx.com@localhost ("Kamil Rytarowski") wrote:
Subject: Re: kern/49207

As I mentioned before compatibility with poorly name constants is not
desirable.

SECLYR? Really? Is this the 80's? Isn't SECONDS_IN_LEAP_YEAR a lot better?

Also each time I will look at 31536000, I'd be tempted to divide
by 365 to see if it is correct. It is not like the compiler will
sweat over computing these, and they are not human friendly. I will
leave the multiplications in.

christos

+#define _SYS_CLOCK_H_
+
+#define IS_LEAP_YEAR(year) ((((year) % 4) == 0 && ((year) % 100) != 0) || ((year%400)) == 0)
+
+/* Some handy constants. */
+#define SECMIN          60
+#define SECHOUR         3600
+#define SECDAY          86400
+#define DAYSYR(year)    (IS_LEAP_YEAR(year) ? 366 : 365)
+#define SECYR           31536000 /* common year */
+#define SECLYR          31622400 /* leap year */
+#define SECYEAR(year)   (DAYSYR(year) * SECDAY)
+
+/* Traditional POSIX base year */
+#define	POSIX_BASE_YEAR	1970
+
+#endif /* _SYS_CLOCK_H_ */

End of excerpt from "Kamil Rytarowski"




Home | Main Index | Thread Index | Old Index