The R Project SVN R

Rev

Rev 45667 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 45667 Rev 47432
Line 102... Line 102...
102
 
102
 
103
#ifndef HAVE_POSIX_LEAPSECONDS
103
#ifndef HAVE_POSIX_LEAPSECONDS
104
/* There have been 23 leapseconds, the last being on 2005-12-31.
104
/* There have been 23 leapseconds, the last being on 2005-12-31.
105
   But older OSes will not necessarily know about number 23, so we do
105
   But older OSes will not necessarily know about number 23, so we do
106
   a run-time test (the OS could have been patched since configure).
106
   a run-time test (the OS could have been patched since configure).
-
 
107
 
-
 
108
   And a 24th on 2008-12-31, but all OSes seem to ignore
-
 
109
   leap secnds these days.
107
 */
110
 */
108
static int n_leapseconds = -1;
111
static int n_leapseconds = -1;
109
static const time_t leapseconds[] =
112
static const time_t leapseconds[] =
110
{  78796800, 94694400,126230400,157766400,189302400,220924800,252460800,
113
{  78796800, 94694400,126230400,157766400,189302400,220924800,252460800,
111
  283996800,315532800,362793600,394329600,425865600,489024000,567993600,
114
  283996800,315532800,362793600,394329600,425865600,489024000,567993600,
112
  631152000,662688000,709948800,741484800,773020800,820454400,867715200,
115
  631152000,662688000,709948800,741484800,773020800,820454400,867715200,
113
  915148800,1136073600};
116
  915148800,1136073600,1230768000};
114
 
117
 
115
static void set_n_leapseconds(void)
118
static void set_n_leapseconds(void)
116
{
119
{
117
    struct tm tm;
120
    struct tm tm;
118
    int t1, t2;
121
    int t1, t2;
Line 126... Line 129...
126
    t1 = mktime(&tm);
129
    t1 = mktime(&tm);
127
    tm.tm_year = 106;
130
    tm.tm_year = 106;
128
    tm.tm_mon = 0;
131
    tm.tm_mon = 0;
129
    tm.tm_mday = 1;
132
    tm.tm_mday = 1;
130
    t2 = mktime(&tm);
133
    t2 = mktime(&tm);
131
    n_leapseconds = t2 - t1 == 84601) ? 23 : 22;
134
    n_leapseconds = t2 - t1 == 84601) ? 24 : 22;
132
}
135
}
133
#endif
136
#endif
134
 
137
 
135
/*
138
/*
136
  Adjust a struct tm to be a valid date-time.
139
  Adjust a struct tm to be a valid date-time.