* ext/date/date_core.c (datetime_s_now): localtime() and localtime_r()
required time_t pointer as 1st parameter, and tv_sec member of struct timeval is long. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
18c34c6c92
commit
5d881f0fd4
@ -1,3 +1,9 @@
|
||||
Mon Feb 28 12:28:13 2011 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* ext/date/date_core.c (datetime_s_now): localtime() and localtime_r()
|
||||
required time_t pointer as 1st parameter, and tv_sec member of struct
|
||||
timeval is long.
|
||||
|
||||
Mon Feb 28 11:57:40 2011 Shota Fukumori <sorah@tubusu.net>
|
||||
|
||||
* test/testunit/test_parallel.rb: Temporally disable test on Windows.
|
||||
|
@ -261,7 +261,7 @@ civil_to_jd(int y, int m, int d, double sg, long *rjd, int *ns)
|
||||
else
|
||||
*ns = 1;
|
||||
|
||||
*rjd = jd;
|
||||
*rjd = (long)jd;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -289,9 +289,9 @@ jd_to_civil(long jd, double sg, int *ry, int *rm, int *rdom)
|
||||
y = c - 4715;
|
||||
}
|
||||
|
||||
*ry = y;
|
||||
*rm = m;
|
||||
*rdom = dom;
|
||||
*ry = (int)y;
|
||||
*rm = (int)m;
|
||||
*rdom = (int)dom;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2443,6 +2443,7 @@ datetime_s_now(int argc, VALUE *argv, VALUE klass)
|
||||
struct timespec ts;
|
||||
#else
|
||||
struct timeval tv;
|
||||
time_t sec;
|
||||
#endif
|
||||
struct tm tm;
|
||||
long y;
|
||||
@ -2463,7 +2464,8 @@ datetime_s_now(int argc, VALUE *argv, VALUE klass)
|
||||
#else
|
||||
if (gettimeofday(&tv, NULL) == -1)
|
||||
rb_sys_fail("gettimeofday");
|
||||
localtime_r(&tv.tv_sec, &tm);
|
||||
sec = tv.tv_sec;
|
||||
localtime_r(&sec, &tm);
|
||||
#endif
|
||||
|
||||
y = tm.tm_year + 1900;
|
||||
|
Loading…
x
Reference in New Issue
Block a user