summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-30 07:41:23 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-30 07:41:23 +0000
commit287810940070b1c7b0cc915e6728da2f0aaac5e2 (patch)
treefd7394d6274c72eb3a15a179c627143bf8fb707f /time.c
parentb6e85a5e29a9790ec33add32bb554b55e3ad4ba9 (diff)
new exception model
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/time.c b/time.c
index dbeafb4..5cb4087 100644
--- a/time.c
+++ b/time.c
@@ -232,6 +232,8 @@ time_arg(argc, argv, args)
ArgError("argument out of range");
}
+static VALUE time_gmtime _((VALUE));
+static VALUE time_localtime _((VALUE));
static VALUE
time_gm_or_local(argc, argv, gm_or_local, klass)
int argc;
@@ -245,6 +247,7 @@ time_gm_or_local(argc, argv, gm_or_local, klass)
time_t guess, t;
int diff;
struct tm *(*fn)();
+ VALUE time;
fn = (gm_or_local) ? gmtime : localtime;
time_arg(argc, argv, args);
@@ -272,7 +275,9 @@ time_gm_or_local(argc, argv, gm_or_local, klass)
guess += (args[4] - tm->tm_min) * 60;
guess += args[5] - tm->tm_sec;
- return time_new_internal(klass, guess, 0);
+ time = time_new_internal(klass, guess, 0);
+ if (gm_or_local) return time_gmtime(time);
+ return time_localtime(time);
error:
ArgError("gmtime/localtime error");