Bug #7326 » time_patch0001.diff
time.c | ||
---|---|---|
static struct tm *localtime_with_gmtoff_zone(const time_t *t, struct tm *result, long *gmtoff, const char **zone);
|
||
/*
|
||
* The idea is come from Perl:
|
||
* The idea is borrowed from Perl:
|
||
* http://use.perl.org/articles/08/02/07/197204.shtml
|
||
*
|
||
* compat_common_month_table is generated by following program.
|
||
* This table finds the last month which start the same day of a week.
|
||
* The year 2037 is not used because
|
||
* compat_common_month_table is generated by the following program.
|
||
* This table finds the last month which starts at the same day of a week.
|
||
* The year 2037 is not used because:
|
||
* http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=522949
|
||
*
|
||
* #!/usr/bin/ruby
|
||
... | ... | |
VALUE timev;
|
||
int y, wday;
|
||
/* The first DST is at 1916 in German.
|
||
* So we don't need to care DST before that. */
|
||
/* Daylight Saving Time was introduced in 1916.
|
||
* So we don't need to care about DST before that. */
|
||
if (lt(vtm_utc->year, INT2FIX(1916))) {
|
||
VALUE off = INT2FIX(0);
|
||
int isdst = 0;
|
||
... | ... | |
return off;
|
||
}
|
||
/* It is difficult to guess future. */
|
||
/* It is difficult to guess the future. */
|
||
vtm2 = *vtm_utc;
|
||
... | ... | |
* _sec_ may have fraction if it is a rational.
|
||
*
|
||
* _utc_offset_ is the offset from UTC.
|
||
* It is a string such as "+09:00" or a number of seconds such as 32400.
|
||
* It can be a string such as "+09:00" or a number of seconds such as 32400.
|
||
*
|
||
* a = Time.new #=> 2007-11-19 07:50:02 -0600
|
||
* b = Time.new #=> 2007-11-19 07:50:02 -0600
|
||
... | ... | |
* t.to_i #=> 1270968744
|
||
*
|
||
* Note that IEEE 754 double is not accurate enough to represent
|
||
* number of nanoseconds from the Epoch.
|
||
* the number of nanoseconds since the Epoch.
|
||
*/
|
||
static VALUE
|
||
... | ... | |
* %z - Time zone as hour and minute offset from UTC (e.g. +0900)
|
||
* %:z - hour and minute offset from UTC with a colon (e.g. +09:00)
|
||
* %::z - hour, minute and second offset from UTC (e.g. +09:00:00)
|
||
* %Z - Time zone abbreviation name or something similar information.
|
||
* %Z - Abbreviated time zone name or similar information.
|
||
*
|
||
* Weekday:
|
||
* %A - The full weekday name (``Sunday'')
|
||
... | ... | |
* %w - Day of the week (Sunday is 0, 0..6)
|
||
*
|
||
* ISO 8601 week-based year and week number:
|
||
* The week 1 of YYYY starts with a Monday and includes YYYY-01-04.
|
||
* The first week of YYYY starts with a Monday and includes YYYY-01-04.
|
||
* The days in the year before the first week are in the last week of
|
||
* the previous year.
|
||
* %G - The week-based year
|
||
... | ... | |
* %V - Week number of the week-based year (01..53)
|
||
*
|
||
* Week number:
|
||
* The week 1 of YYYY starts with a Sunday or Monday (according to %U
|
||
* or %W). The days in the year before the first week are in week 0.
|
||
* %U - Week number of the year. The week starts with Sunday. (00..53)
|
||
* %W - Week number of the year. The week starts with Monday. (00..53)
|
||
* The first week of YYYY that starts with a Sunday or Monday (according to %U
|
||
* or %W). The days in the year before the first week are in week 0.
|
||
* %U - Week number of the year. The week starts with Sunday. (00..53)
|
||
* %W - Week number of the year. The week starts with Monday. (00..53)
|
||
*
|
||
* Seconds since the Epoch:
|
||
* %s - Number of seconds since 1970-01-01 00:00:00 UTC.
|
||
... | ... | |
*
|
||
* t + (60*60*24*365) #=> 1994-02-24 12:00:00 +0900
|
||
*
|
||
* How many second was that from the Unix Epoch?
|
||
* How many seconds was that since the Unix Epoch?
|
||
*
|
||
* t.to_i #=> 730522800
|
||
*
|