Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: third_party/libxslt/libexslt/date.c

Issue 661058: libxslt update (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libxslt/libexslt/crypto.c ('k') | third_party/libxslt/libexslt/exslt.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * date.c: Implementation of the EXSLT -- Dates and Times module 2 * date.c: Implementation of the EXSLT -- Dates and Times module
3 * 3 *
4 * References: 4 * References:
5 * http://www.exslt.org/date/date.html 5 * http://www.exslt.org/date/date.html
6 * 6 *
7 * See Copyright for the status of this software. 7 * See Copyright for the status of this software.
8 * 8 *
9 * Authors: 9 * Authors:
10 * Charlie Bozeman <cbozeman@HiWAAY.net> 10 * Charlie Bozeman <cbozeman@HiWAAY.net>
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 #ifdef WITH_TIME 740 #ifdef WITH_TIME
741 /** 741 /**
742 * exsltDateCurrent: 742 * exsltDateCurrent:
743 * 743 *
744 * Returns the current date and time. 744 * Returns the current date and time.
745 */ 745 */
746 static exsltDateValPtr 746 static exsltDateValPtr
747 exsltDateCurrent (void) 747 exsltDateCurrent (void)
748 { 748 {
749 struct tm localTm, gmTm; 749 struct tm localTm, gmTm;
750 time_t secs, gsecs; 750 time_t secs;
751 int local_s, gm_s; 751 int local_s, gm_s;
752 exsltDateValPtr ret; 752 exsltDateValPtr ret;
753 753
754 ret = exsltDateCreateDate(XS_DATETIME); 754 ret = exsltDateCreateDate(XS_DATETIME);
755 if (ret == NULL) 755 if (ret == NULL)
756 return NULL; 756 return NULL;
757 757
758 /* get current time */ 758 /* get current time */
759 secs = time(NULL); 759 secs = time(NULL);
760 #if HAVE_LOCALTIME_R 760 #if HAVE_LOCALTIME_R
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after
2169 * is the first day-in-week 2169 * is the first day-in-week
2170 */ 2170 */
2171 diw = (_exsltDateDayInWeek(diy, dt->value.date.year) + 6) % 7; 2171 diw = (_exsltDateDayInWeek(diy, dt->value.date.year) + 6) % 7;
2172 2172
2173 /* ISO 8601 adjustment, 3 is Thu */ 2173 /* ISO 8601 adjustment, 3 is Thu */
2174 diy += (3 - diw); 2174 diy += (3 - diw);
2175 if(diy < 1) { 2175 if(diy < 1) {
2176 year = dt->value.date.year - 1; 2176 year = dt->value.date.year - 1;
2177 if(year == 0) year--; 2177 if(year == 0) year--;
2178 diy = DAY_IN_YEAR(31, 12, year) + diy; 2178 diy = DAY_IN_YEAR(31, 12, year) + diy;
2179 } else if (diy > DAY_IN_YEAR(31, 12, dt->value.date.year)) { 2179 } else if (diy > (long)DAY_IN_YEAR(31, 12, dt->value.date.year)) {
2180 diy -= DAY_IN_YEAR(31, 12, dt->value.date.year); 2180 diy -= DAY_IN_YEAR(31, 12, dt->value.date.year);
2181 } 2181 }
2182 2182
2183 ret = ((diy - 1) / 7) + 1; 2183 ret = ((diy - 1) / 7) + 1;
2184 2184
2185 exsltDateFreeDate(dt); 2185 exsltDateFreeDate(dt);
2186 2186
2187 return (double) ret; 2187 return (double) ret;
2188 } 2188 }
2189 2189
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
3785 xsltRegisterExtModuleFunction ((const xmlChar *) "week-in-month", 3785 xsltRegisterExtModuleFunction ((const xmlChar *) "week-in-month",
3786 (const xmlChar *) EXSLT_DATE_NAMESPACE, 3786 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3787 exsltDateWeekInMonthFunction); 3787 exsltDateWeekInMonthFunction);
3788 xsltRegisterExtModuleFunction ((const xmlChar *) "week-in-year", 3788 xsltRegisterExtModuleFunction ((const xmlChar *) "week-in-year",
3789 (const xmlChar *) EXSLT_DATE_NAMESPACE, 3789 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3790 exsltDateWeekInYearFunction); 3790 exsltDateWeekInYearFunction);
3791 xsltRegisterExtModuleFunction ((const xmlChar *) "year", 3791 xsltRegisterExtModuleFunction ((const xmlChar *) "year",
3792 (const xmlChar *) EXSLT_DATE_NAMESPACE, 3792 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3793 exsltDateYearFunction); 3793 exsltDateYearFunction);
3794 } 3794 }
3795
3796 /**
3797 * exsltDateXpathCtxtRegister:
3798 *
3799 * Registers the EXSLT - Dates and Times module for use outside XSLT
3800 */
3801 int
3802 exsltDateXpathCtxtRegister (xmlXPathContextPtr ctxt, const xmlChar *prefix)
3803 {
3804 if (ctxt
3805 && prefix
3806 && !xmlXPathRegisterNs(ctxt,
3807 prefix,
3808 (const xmlChar *) EXSLT_DATE_NAMESPACE)
3809 && !xmlXPathRegisterFuncNS(ctxt,
3810 (const xmlChar *) "add",
3811 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3812 exsltDateAddFunction)
3813 && !xmlXPathRegisterFuncNS(ctxt,
3814 (const xmlChar *) "add-duration",
3815 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3816 exsltDateAddDurationFunction)
3817 && !xmlXPathRegisterFuncNS(ctxt,
3818 (const xmlChar *) "date",
3819 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3820 exsltDateDateFunction)
3821 #ifdef WITH_TIME
3822 && !xmlXPathRegisterFuncNS(ctxt,
3823 (const xmlChar *) "date-time",
3824 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3825 exsltDateDateTimeFunction)
3826 #endif
3827 && !xmlXPathRegisterFuncNS(ctxt,
3828 (const xmlChar *) "day-abbreviation",
3829 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3830 exsltDateDayAbbreviationFunction)
3831 && !xmlXPathRegisterFuncNS(ctxt,
3832 (const xmlChar *) "day-in-month",
3833 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3834 exsltDateDayInMonthFunction)
3835 && !xmlXPathRegisterFuncNS(ctxt,
3836 (const xmlChar *) "day-in-week",
3837 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3838 exsltDateDayInWeekFunction)
3839 && !xmlXPathRegisterFuncNS(ctxt,
3840 (const xmlChar *) "day-in-year",
3841 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3842 exsltDateDayInYearFunction)
3843 && !xmlXPathRegisterFuncNS(ctxt,
3844 (const xmlChar *) "day-name",
3845 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3846 exsltDateDayNameFunction)
3847 && !xmlXPathRegisterFuncNS(ctxt,
3848 (const xmlChar *) "day-of-week-in-month",
3849 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3850 exsltDateDayOfWeekInMonthFunction)
3851 && !xmlXPathRegisterFuncNS(ctxt,
3852 (const xmlChar *) "difference",
3853 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3854 exsltDateDifferenceFunction)
3855 && !xmlXPathRegisterFuncNS(ctxt,
3856 (const xmlChar *) "duration",
3857 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3858 exsltDateDurationFunction)
3859 && !xmlXPathRegisterFuncNS(ctxt,
3860 (const xmlChar *) "hour-in-day",
3861 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3862 exsltDateHourInDayFunction)
3863 && !xmlXPathRegisterFuncNS(ctxt,
3864 (const xmlChar *) "leap-year",
3865 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3866 exsltDateLeapYearFunction)
3867 && !xmlXPathRegisterFuncNS(ctxt,
3868 (const xmlChar *) "minute-in-hour",
3869 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3870 exsltDateMinuteInHourFunction)
3871 && !xmlXPathRegisterFuncNS(ctxt,
3872 (const xmlChar *) "month-abbreviation",
3873 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3874 exsltDateMonthAbbreviationFunction)
3875 && !xmlXPathRegisterFuncNS(ctxt,
3876 (const xmlChar *) "month-in-year",
3877 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3878 exsltDateMonthInYearFunction)
3879 && !xmlXPathRegisterFuncNS(ctxt,
3880 (const xmlChar *) "month-name",
3881 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3882 exsltDateMonthNameFunction)
3883 && !xmlXPathRegisterFuncNS(ctxt,
3884 (const xmlChar *) "second-in-minute",
3885 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3886 exsltDateSecondInMinuteFunction)
3887 && !xmlXPathRegisterFuncNS(ctxt,
3888 (const xmlChar *) "seconds",
3889 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3890 exsltDateSecondsFunction)
3891 && !xmlXPathRegisterFuncNS(ctxt,
3892 (const xmlChar *) "sum",
3893 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3894 exsltDateSumFunction)
3895 && !xmlXPathRegisterFuncNS(ctxt,
3896 (const xmlChar *) "time",
3897 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3898 exsltDateTimeFunction)
3899 && !xmlXPathRegisterFuncNS(ctxt,
3900 (const xmlChar *) "week-in-month",
3901 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3902 exsltDateWeekInMonthFunction)
3903 && !xmlXPathRegisterFuncNS(ctxt,
3904 (const xmlChar *) "week-in-year",
3905 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3906 exsltDateWeekInYearFunction)
3907 && !xmlXPathRegisterFuncNS(ctxt,
3908 (const xmlChar *) "year",
3909 (const xmlChar *) EXSLT_DATE_NAMESPACE,
3910 exsltDateYearFunction)) {
3911 return 0;
3912 }
3913 return -1;
3914 }
OLDNEW
« no previous file with comments | « third_party/libxslt/libexslt/crypto.c ('k') | third_party/libxslt/libexslt/exslt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698