diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-02-28 03:28:24 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-02-28 03:28:24 +0000 |
commit | 5d881f0fd44b6339f30e66239a6f0efd20e6d580 (patch) | |
tree | e67b153c2a70d24b8ceeb6307a7a5d71a91af6fb /ext | |
parent | 18c34c6c92659b4bd176143be0c5ee75c72f60d0 (diff) |
* 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
Diffstat (limited to 'ext')
-rw-r--r-- | ext/date/date_core.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/date/date_core.c b/ext/date/date_core.c index 917da6c62a..d3a664c282 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -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; |