+ rtc-add-rtc_year_days-to-calculate-tm_yday.patch added to -mm tree

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

 



The patch titled

     RTC: Add rtc_year_days() to calculate tm_yday

has been added to the -mm tree.  Its filename is

     rtc-add-rtc_year_days-to-calculate-tm_yday.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: RTC: Add rtc_year_days() to calculate tm_yday
From: Andrew Victor <andrew@xxxxxxxxxxxxx>


RTC: Add exported function rtc_year_days() to calculate the tm_yday value.

Signed-off-by: Andrew Victor <andrew@xxxxxxxxxxxxx>
Signed-off-by: Alessandro Zummo <a.zummo@xxxxxxxxxxxx>
Cc: Russell King <rmk@xxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/rtc/rtc-lib.c |   19 +++++++++++++++++++
 include/linux/rtc.h   |    1 +
 2 files changed, 20 insertions(+)

diff -puN drivers/rtc/rtc-lib.c~rtc-add-rtc_year_days-to-calculate-tm_yday drivers/rtc/rtc-lib.c
--- devel/drivers/rtc/rtc-lib.c~rtc-add-rtc_year_days-to-calculate-tm_yday	2006-06-08 00:04:07.000000000 -0700
+++ devel-akpm/drivers/rtc/rtc-lib.c	2006-06-08 00:04:07.000000000 -0700
@@ -18,9 +18,19 @@ static const unsigned char rtc_days_in_m
 	31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
 };
 
+static const unsigned short rtc_ydays[2][13] = {
+	/* Normal years */
+	{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
+	/* Leap years */
+	{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
+};
+
 #define LEAPS_THRU_END_OF(y) ((y)/4 - (y)/100 + (y)/400)
 #define LEAP_YEAR(year) ((!(year % 4) && (year % 100)) || !(year % 400))
 
+/*
+ * The number of days in the month.
+ */
 int rtc_month_days(unsigned int month, unsigned int year)
 {
 	return rtc_days_in_month[month] + (LEAP_YEAR(year) && month == 1);
@@ -28,6 +38,15 @@ int rtc_month_days(unsigned int month, u
 EXPORT_SYMBOL(rtc_month_days);
 
 /*
+ * The number of days since January 1. (0 to 365)
+ */
+int rtc_year_days(unsigned int day, unsigned int month, unsigned int year)
+{
+	return rtc_ydays[LEAP_YEAR(year)][month] + day-1;
+}
+EXPORT_SYMBOL(rtc_year_days);
+
+/*
  * Convert seconds since 01-01-1970 00:00:00 to Gregorian date.
  */
 void rtc_time_to_tm(unsigned long time, struct rtc_time *tm)
diff -puN include/linux/rtc.h~rtc-add-rtc_year_days-to-calculate-tm_yday include/linux/rtc.h
--- devel/include/linux/rtc.h~rtc-add-rtc_year_days-to-calculate-tm_yday	2006-06-08 00:04:07.000000000 -0700
+++ devel-akpm/include/linux/rtc.h	2006-06-08 00:04:07.000000000 -0700
@@ -102,6 +102,7 @@ struct rtc_pll_info {
 #include <linux/interrupt.h>
 
 extern int rtc_month_days(unsigned int month, unsigned int year);
+extern int rtc_year_days(unsigned int day, unsigned int month, unsigned int year);
 extern int rtc_valid_tm(struct rtc_time *tm);
 extern int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time);
 extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm);
_

Patches currently in -mm which might be from andrew@xxxxxxxxxxxxx are

git-watchdog.patch
rtc-add-rtc_year_days-to-calculate-tm_yday.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux