Project

General

Profile

Bug #7326 ยป time_patch0001.diff

bt (Bernd Homuth), 11/24/2012 07:38 PM

View differences:

time.c
1399 1399
static struct tm *localtime_with_gmtoff_zone(const time_t *t, struct tm *result, long *gmtoff, const char **zone);
1400 1400

  
1401 1401
/*
1402
 * The idea is come from Perl:
1402
 * The idea is borrowed from Perl:
1403 1403
 * http://use.perl.org/articles/08/02/07/197204.shtml
1404 1404
 *
1405
 * compat_common_month_table is generated by following program.
1406
 * This table finds the last month which start the same day of a week.
1407
 * The year 2037 is not used because
1405
 * compat_common_month_table is generated by the following program.
1406
 * This table finds the last month which starts at the same day of a week.
1407
 * The year 2037 is not used because:
1408 1408
 * http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=522949
1409 1409
 *
1410 1410
 *  #!/usr/bin/ruby
......
1502 1502
    VALUE timev;
1503 1503
    int y, wday;
1504 1504

  
1505
    /* The first DST is at 1916 in German.
1506
     * So we don't need to care DST before that. */
1505
    /* Daylight Saving Time was introduced in 1916.
1506
     * So we don't need to care about DST before that. */
1507 1507
    if (lt(vtm_utc->year, INT2FIX(1916))) {
1508 1508
        VALUE off = INT2FIX(0);
1509 1509
        int isdst = 0;
......
1537 1537
        return off;
1538 1538
    }
1539 1539

  
1540
    /* It is difficult to guess future. */
1540
    /* It is difficult to guess the future. */
1541 1541

  
1542 1542
    vtm2 = *vtm_utc;
1543 1543

  
......
2232 2232
 *  _sec_ may have fraction if it is a rational.
2233 2233
 *
2234 2234
 *  _utc_offset_ is the offset from UTC.
2235
 *  It is a string such as "+09:00" or a number of seconds such as 32400.
2235
 *  It can be a string such as "+09:00" or a number of seconds such as 32400.
2236 2236
 *
2237 2237
 *     a = Time.new      #=> 2007-11-19 07:50:02 -0600
2238 2238
 *     b = Time.new      #=> 2007-11-19 07:50:02 -0600
......
3202 3202
 *     t.to_i              #=> 1270968744
3203 3203
 *
3204 3204
 *  Note that IEEE 754 double is not accurate enough to represent
3205
 *  number of nanoseconds from the Epoch.
3205
 *  the number of nanoseconds since the Epoch.
3206 3206
 */
3207 3207

  
3208 3208
static VALUE
......
4448 4448
 *      %z - Time zone as hour and minute offset from UTC (e.g. +0900)
4449 4449
 *              %:z - hour and minute offset from UTC with a colon (e.g. +09:00)
4450 4450
 *              %::z - hour, minute and second offset from UTC (e.g. +09:00:00)
4451
 *      %Z - Time zone abbreviation name or something similar information.
4451
 *      %Z - Abbreviated time zone name or similar information.
4452 4452
 *
4453 4453
 *    Weekday:
4454 4454
 *      %A - The full weekday name (``Sunday'')
......
4459 4459
 *      %w - Day of the week (Sunday is 0, 0..6)
4460 4460
 *
4461 4461
 *    ISO 8601 week-based year and week number:
4462
 *    The week 1 of YYYY starts with a Monday and includes YYYY-01-04.
4462
 *    The first week of YYYY starts with a Monday and includes YYYY-01-04.
4463 4463
 *    The days in the year before the first week are in the last week of
4464 4464
 *    the previous year.
4465 4465
 *      %G - The week-based year
......
4467 4467
 *      %V - Week number of the week-based year (01..53)
4468 4468
 *
4469 4469
 *    Week number:
4470
 *    The week 1 of YYYY starts with a Sunday or Monday (according to %U
4471
 *    or %W).  The days in the year before the first week are in week 0.
4472
 *      %U - Week number of the year.  The week starts with Sunday.  (00..53)
4473
 *      %W - Week number of the year.  The week starts with Monday.  (00..53)
4470
 *    The first week of YYYY that starts with a Sunday or Monday (according to %U
4471
 *    or %W). The days in the year before the first week are in week 0.
4472
 *      %U - Week number of the year. The week starts with Sunday. (00..53)
4473
 *      %W - Week number of the year. The week starts with Monday. (00..53)
4474 4474
 *
4475 4475
 *    Seconds since the Epoch:
4476 4476
 *      %s - Number of seconds since 1970-01-01 00:00:00 UTC.
......
4930 4930
 *
4931 4931
 *    t + (60*60*24*365) #=> 1994-02-24 12:00:00 +0900
4932 4932
 *
4933
 *  How many second was that from the Unix Epoch?
4933
 *  How many seconds was that since the Unix Epoch?
4934 4934
 *
4935 4935
 *    t.to_i #=> 730522800
4936 4936
 *
4937
-