OLD | NEW |
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* ***** BEGIN LICENSE BLOCK ***** | 2 /* ***** BEGIN LICENSE BLOCK ***** |
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
4 * | 4 * |
5 * The contents of this file are subject to the Mozilla Public License Version | 5 * The contents of this file are subject to the Mozilla Public License Version |
6 * 1.1 (the "License"); you may not use this file except in compliance with | 6 * 1.1 (the "License"); you may not use this file except in compliance with |
7 * the License. You may obtain a copy of the License at | 7 * the License. You may obtain a copy of the License at |
8 * http://www.mozilla.org/MPL/ | 8 * http://www.mozilla.org/MPL/ |
9 * | 9 * |
10 * Software distributed under the License is distributed on an "AS IS" basis, | 10 * Software distributed under the License is distributed on an "AS IS" basis, |
(...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 a.tm_yday = tm->tm_yday; | 1721 a.tm_yday = tm->tm_yday; |
1722 a.tm_isdst = tm->tm_params.tp_dst_offset ? 1 : 0; | 1722 a.tm_isdst = tm->tm_params.tp_dst_offset ? 1 : 0; |
1723 | 1723 |
1724 /* | 1724 /* |
1725 * On some platforms, for example SunOS 4, struct tm has two | 1725 * On some platforms, for example SunOS 4, struct tm has two |
1726 * additional fields: tm_zone and tm_gmtoff. | 1726 * additional fields: tm_zone and tm_gmtoff. |
1727 */ | 1727 */ |
1728 | 1728 |
1729 #if defined(SUNOS4) || (__GLIBC__ >= 2) || defined(XP_BEOS) \ | 1729 #if defined(SUNOS4) || (__GLIBC__ >= 2) || defined(XP_BEOS) \ |
1730 || defined(NETBSD) || defined(OPENBSD) || defined(FREEBSD) \ | 1730 || defined(NETBSD) || defined(OPENBSD) || defined(FREEBSD) \ |
1731 || defined(DARWIN) || defined(SYMBIAN) | 1731 || defined(DARWIN) || defined(SYMBIAN) || defined(ANDROID) |
1732 a.tm_zone = NULL; | 1732 a.tm_zone = NULL; |
1733 a.tm_gmtoff = tm->tm_params.tp_gmt_offset + | 1733 a.tm_gmtoff = tm->tm_params.tp_gmt_offset + |
1734 tm->tm_params.tp_dst_offset; | 1734 tm->tm_params.tp_dst_offset; |
1735 #endif | 1735 #endif |
1736 } else { | 1736 } else { |
1737 ap = NULL; | 1737 ap = NULL; |
1738 } | 1738 } |
1739 | 1739 |
1740 rv = strftime(buf, buflen, fmt, ap); | 1740 rv = strftime(buf, buflen, fmt, ap); |
1741 if (!rv && buf && buflen > 0) { | 1741 if (!rv && buf && buflen > 0) { |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2033 /* Count the number of full weeks ( dayOfYear / 7 ) then add a week if ther
e | 2033 /* Count the number of full weeks ( dayOfYear / 7 ) then add a week if ther
e |
2034 * are any days left over ( dayOfYear % 7 ). Because we are only counting
to | 2034 * are any days left over ( dayOfYear % 7 ). Because we are only counting
to |
2035 * the first day of the week containing the given time, rather than to the | 2035 * the first day of the week containing the given time, rather than to the |
2036 * actual day representing the given time, any days in week 0 will be "abso
rbed" | 2036 * actual day representing the given time, any days in week 0 will be "abso
rbed" |
2037 * as extra days in the given week. | 2037 * as extra days in the given week. |
2038 */ | 2038 */ |
2039 return (dayOfYear / 7) + ( (dayOfYear % 7) == 0 ? 0 : 1 ); | 2039 return (dayOfYear / 7) + ( (dayOfYear % 7) == 0 ? 0 : 1 ); |
2040 } | 2040 } |
2041 } | 2041 } |
2042 | 2042 |
OLD | NEW |