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 /* This Source Code Form is subject to the terms of the Mozilla Public | 2 /* This Source Code Form is subject to the terms of the Mozilla Public |
3 * License, v. 2.0. If a copy of the MPL was not distributed with this | 3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | 5 |
6 /* | 6 /* |
7 * prtime.c -- | 7 * prtime.c -- |
8 * | 8 * |
9 * NSPR date and time functions | 9 * NSPR date and time functions |
10 * | 10 * |
(...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1688 a.tm_wday = tm->tm_wday; | 1688 a.tm_wday = tm->tm_wday; |
1689 a.tm_year = tm->tm_year - 1900; | 1689 a.tm_year = tm->tm_year - 1900; |
1690 a.tm_yday = tm->tm_yday; | 1690 a.tm_yday = tm->tm_yday; |
1691 a.tm_isdst = tm->tm_params.tp_dst_offset ? 1 : 0; | 1691 a.tm_isdst = tm->tm_params.tp_dst_offset ? 1 : 0; |
1692 | 1692 |
1693 /* | 1693 /* |
1694 * On some platforms, for example SunOS 4, struct tm has two | 1694 * On some platforms, for example SunOS 4, struct tm has two |
1695 * additional fields: tm_zone and tm_gmtoff. | 1695 * additional fields: tm_zone and tm_gmtoff. |
1696 */ | 1696 */ |
1697 | 1697 |
1698 #if defined(SUNOS4) || (__GLIBC__ >= 2) || defined(XP_BEOS) \ | 1698 #if (__GLIBC__ >= 2) || defined(XP_BEOS) \ |
1699 || defined(NETBSD) || defined(OPENBSD) || defined(FREEBSD) \ | 1699 || defined(NETBSD) || defined(OPENBSD) || defined(FREEBSD) \ |
1700 || defined(DARWIN) || defined(SYMBIAN) || defined(ANDROID) | 1700 || defined(DARWIN) || defined(SYMBIAN) || defined(ANDROID) |
1701 a.tm_zone = NULL; | 1701 a.tm_zone = NULL; |
1702 a.tm_gmtoff = tm->tm_params.tp_gmt_offset + | 1702 a.tm_gmtoff = tm->tm_params.tp_gmt_offset + |
1703 tm->tm_params.tp_dst_offset; | 1703 tm->tm_params.tp_dst_offset; |
1704 #endif | 1704 #endif |
1705 } else { | 1705 } else { |
1706 ap = NULL; | 1706 ap = NULL; |
1707 } | 1707 } |
1708 | 1708 |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 /* Count the number of full weeks ( dayOfYear / 7 ) then add a week if ther
e | 2002 /* Count the number of full weeks ( dayOfYear / 7 ) then add a week if ther
e |
2003 * are any days left over ( dayOfYear % 7 ). Because we are only counting
to | 2003 * are any days left over ( dayOfYear % 7 ). Because we are only counting
to |
2004 * the first day of the week containing the given time, rather than to the | 2004 * the first day of the week containing the given time, rather than to the |
2005 * actual day representing the given time, any days in week 0 will be "abso
rbed" | 2005 * actual day representing the given time, any days in week 0 will be "abso
rbed" |
2006 * as extra days in the given week. | 2006 * as extra days in the given week. |
2007 */ | 2007 */ |
2008 return (dayOfYear / 7) + ( (dayOfYear % 7) == 0 ? 0 : 1 ); | 2008 return (dayOfYear / 7) + ( (dayOfYear % 7) == 0 ? 0 : 1 ); |
2009 } | 2009 } |
2010 } | 2010 } |
2011 | 2011 |
OLD | NEW |