summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-04-16 09:45:14 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-04-16 09:45:14 +0000
commite2a513c54e6792270468fd13b926d83f9f643f5f (patch)
treeb0467cd16de11475f3b66d56d2720324d8245b1a /time.c
parent95bd0ad8c00e4b46e604be5592c0b00cd23f2ba2 (diff)
I thins tv_sec should be time_t. hmm
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/time.c b/time.c
index c8658d97855..f4bb8bfbc2e 100644
--- a/time.c
+++ b/time.c
@@ -66,7 +66,7 @@ time_s_now(klass)
obj = Data_Make_Struct(klass, struct time_object, 0, free, tobj);
tobj->tm_got=0;
- if (gettimeofday(&(tobj->tv), 0) < 0) {
+ if (gettimeofday(&tobj->tv, 0) < 0) {
rb_sys_fail("gettimeofday");
}
rb_obj_call_init(obj, 0, 0);
@@ -469,9 +469,10 @@ time_localtime(time)
{
struct time_object *tobj;
struct tm *tm_tmp;
+ time_t t = tobj->tv.tv_sec;
GetTimeval(time, tobj);
- tm_tmp = localtime((const time_t*)&tobj->tv.tv_sec);
+ tm_tmp = localtime(&t);
tobj->tm = *tm_tmp;
tobj->tm_got = 1;
tobj->gmt = 0;
@@ -484,9 +485,10 @@ time_gmtime(time)
{
struct time_object *tobj;
struct tm *tm_tmp;
+ time_t t = tobj->tv.tv_sec;
GetTimeval(time, tobj);
- tm_tmp = gmtime((const time_t*)&tobj->tv.tv_sec);
+ tm_tmp = gmtime(&t);
tobj->tm = *tm_tmp;
tobj->tm_got = 1;
tobj->gmt = 1;
@@ -513,7 +515,7 @@ time_asctime(time)
if (tobj->tm_got == 0) {
time_get_tm(time, tobj->gmt);
}
- s = asctime(&(tobj->tm));
+ s = asctime(&tobj->tm);
if (s[24] == '\n') s[24] = '\0';
return rb_str_new2(s);
@@ -886,12 +888,13 @@ time_dump(argc, argv, time)
struct tm *tm;
unsigned long p, s;
unsigned char buf[8];
+ time_t t = tobj->tv.tv_sec;
int i;
rb_scan_args(argc, argv, "01", &dummy);
GetTimeval(time, tobj);
- tm = gmtime((const time_t*)&tobj->tv.tv_sec);
+ tm = gmtime(&t);
p = 0x1 << 31 | /* 1 */
tm->tm_year << 14 | /* 17 */