diff options
author | Tanaka Akira <akr@fsij.org> | 2020-01-28 23:40:25 +0900 |
---|---|---|
committer | Tanaka Akira <akr@fsij.org> | 2020-01-28 23:40:25 +0900 |
commit | 338c5b8c1dc061e9f8d21f6d9f5ac053c4497383 (patch) | |
tree | b5cc7143cb75eb026c49f24dc83bf4b859f2c39f | |
parent | fb41246ddb2dd3c1b4595cd7e27ed3710def3fc8 (diff) |
Extract a function, ruby_reset_timezone().
Initial implementation of ruby_reset_timezone()
assigns ruby_tz_uptodate_p to false.
-rw-r--r-- | hash.c | 6 | ||||
-rw-r--r-- | internal/time.h | 1 | ||||
-rw-r--r-- | time.c | 6 |
3 files changed, 10 insertions, 3 deletions
@@ -35,6 +35,7 @@ #include "internal/object.h" #include "internal/proc.h" #include "internal/symbol.h" +#include "internal/time.h" #include "internal/vm.h" #include "probes.h" #include "ruby/st.h" @@ -4758,7 +4759,6 @@ env_str_new2(const char *ptr) } static const char TZ_ENV[] = "TZ"; -extern bool ruby_tz_uptodate_p; static rb_encoding * env_encoding_for(const char *name, const char *ptr) @@ -4843,7 +4843,7 @@ env_delete(VALUE name) * This hack might works only on Linux glibc. */ if (ENVMATCH(nam, TZ_ENV)) { - ruby_tz_uptodate_p = FALSE; + ruby_reset_timezone(); } if (val) { @@ -5275,7 +5275,7 @@ env_aset(VALUE nm, VALUE val) RB_GC_GUARD(nm); } else if (ENVMATCH(name, TZ_ENV)) { - ruby_tz_uptodate_p = FALSE; + ruby_reset_timezone(); } return val; } diff --git a/internal/time.h b/internal/time.h index ef3d64e967..8f84899221 100644 --- a/internal/time.h +++ b/internal/time.h @@ -29,6 +29,7 @@ struct timeval rb_time_timeval(VALUE); RUBY_SYMBOL_EXPORT_BEGIN /* time.c (export) */ void ruby_reset_leap_second_info(void); +void ruby_reset_timezone(void); RUBY_SYMBOL_EXPORT_END #endif /* INTERNAL_TIME_H */ @@ -683,6 +683,12 @@ static VALUE tm_from_time(VALUE klass, VALUE time); bool ruby_tz_uptodate_p; +void +ruby_reset_timezone(void) +{ + ruby_tz_uptodate_p = false; +} + static void update_tz(void) { |