aboutsummaryrefslogtreecommitdiffstats
path: root/time.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Time.at in: tznobu2018-11-281-6/+12
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Timezone at Time.atnobu2018-11-281-2/+17
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Try Time.find_timezone to convert name to timezonenobu2018-11-281-17/+54
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Try Time.find_timezone to loadnobu2018-11-281-2/+17
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Normalize month-mday before finding epochnaruse2018-11-251-0/+23
| | | | | | | Especially over the year 2038, 30 Feb and so on may cause odd behavior on validating found epoch with given year-month-day [Bug #15340] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Hide Time::TM as Time::tmnobu2018-11-041-55/+67
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c: [DOC] fix method names to refer class methods [ci skip]nobu2018-10-291-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c: added Time::TM#+ and Time::TM#-nobu2018-10-281-4/+24
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c: ignore 7th argnobu2018-10-281-21/+19
| | | | | | | * time.c (tm_initialize): allow 7th argument as well as Time#initialize, but just ignore. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c: [DOC] add description and fix markups [ci skip]nobu2018-10-281-12/+19
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c: [DOC] fix rdoc-ref [ci skip]nobu2018-10-281-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c: [DOC] about timezone arguemnt [ci skip]nobu2018-10-281-2/+28
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c: benchmark recoverynobu2018-10-251-1/+3
| | | | | | | | | | * time.c (time_localtime): check if `vtm.zone` is a simple zone name string before trying to call the conversion method. since r64952, `Time.getlocal` on UTC time has lost the performance about 45%, due to this call. the performance is about 90% of r64951 by avoiding it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Let Time::TM share the implementation with Timenobu2018-10-231-1/+30
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* No longer subsec and isdst membersnobu2018-10-221-6/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert TM_IS_TIME to 1nobu2018-10-221-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Return fixed values at subsec, utc_offset, and isdstnobu2018-10-221-3/+37
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c: optional arguments of Time::TM#initializenobu2018-10-221-5/+5
| | | | | | | * time.c (tm_initialize): arguments other than year are optional now as Time.new. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Prefer `rb_fstring_lit` over `rb_fstring_cstr`nobu2018-10-131-12/+10
| | | | | | | The former states explicitly that the argument must be a literal, and can optimize away `strlen` on all compilers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix overwritten zone stringnobu2018-10-121-2/+6
| | | | | | | | | | | * time.c (zone_str): while rb_fstring_usascii and the family require that the argument string is never modified, tzname may point areas which will be discarded by calling tzset(). make a String then call rb_fstring to copy the zone name. when an ID equals TZ environment variable, its name string also has modified by changing tzname. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Initialize zonenobu2018-10-121-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Load as FIXOFF mode if zone is presentnobu2018-10-121-4/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Just copy tzmodenobu2018-10-121-15/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Timezone at Time#+ and Time#-nobu2018-10-081-0/+8
| | | | | | * time.c (time_add): support for Timezone. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * expand tabs.svn2018-10-081-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Timezone support by Time [Feature #14850]nobu2018-10-081-16/+393
| | | | | | | | | * strftime.c (rb_strftime): support timezone object by `%z`. * time.c (time_init_1, time_new_timew, time_getlocaltime): accept timezone object as `off`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix messages for too small yearnobu2018-09-271-2/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c split time_utc_or_localnobu2018-09-121-18/+10
| | | | | | | * time.c (time_utc_or_local): split into time_s_mkutc and time_s_mktime without utc flag. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rename an argument of calc_wday.akr2018-08-211-6/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gmtimew_noleapsecond uses tables for mon and mday.akr2018-08-151-14/+69
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* timegm_noleapsecond uses calc_tm_yday.akr2018-08-121-5/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rename several internal macros in time.cakr2018-08-081-35/+35
| | | | | | | | | | | | | | TIME_UTC_P -> TZMODE_UTC_P TIME_SET_UTC -> TZMODE_SET_UTC TIME_LOCALTIME_P -> TZMODE_LOCALTIME_P TIME_SET_LOCALTIME -> TZMODE_SET_LOCALTIME TIME_FIXOFF_P -> TZMODE_FIXOFF_P TIME_SET_FIXOFF -> TZMODE_SET_FIXOFF TIME_COPY_GMT -> TZMODE_COPY git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Update comment of tzmode [ci skip]kazu2018-08-081-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Rename gmt field to tzmode in struct time_object.akr2018-08-081-15/+19
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Store String as zone in struct vtm.akr2018-08-081-65/+47
| | | | | | | This removes zone_table and use fstring instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* renamed ruby_tz_update as ruby_tz_uptodate_pnobu2018-07-191-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* reduce tzsetnobu2018-07-181-1/+7
| | | | | | | * time.c (rb_localtime_r): call tzset() only after TZ environment variable is changed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Prefixed reset_leap_second_infonobu2018-07-061-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Re-apply r63848 (Optimize Time.utc)naruse2018-07-051-2/+22
| | | | | | | | * Both timegmw and gmtimew ignores leap second if the timezone doesn't have leap seconds on the first call of init_leap_second_info() * Add Bug::Time.reset_leap_second_info for testing git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert "Optimize Time.utc"naruse2018-07-041-3/+0
| | | | | | | This reverts commit r63848. It breaks tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Optimize Time.utcnaruse2018-07-041-0/+3
| | | | | | | | | | | | | | | | | | Time.utc uses timegmw() and it uses leap second information. If the given time is larger than known_leap_seconds_limit, it calls find_time_t, which uses localtime(3) and calls stat(2) in it. This patch avoid it by setting known_leap_seconds_limit to 0 if the timezone doesn't have leapsecond information (if no leap second is found "now", I assume the timezone doesn't have leapsecond information). Before: % time ./miniruby --disable-gem -e'time = Time.now; year = time.year; month = time.month; day = time.day; hour = time.hour; min = time.min; sec = time.sec + time.subsec; i = 0; while i < 100000; ::Time.utc(year, month, day, hour, min, sec); i += 1; end' ./miniruby --disable-gem 0.35s user 0.19s system 99% cpu 0.542 total After: % time ./miniruby --disable-gem -e'time = Time.now; year = time.year; month = time.month; day = time.day; hour = time.hour; min = time.min; sec = time.sec + time.subsec; i = 0; while i < 100000; ::Time.utc(year, month, day, hour, min, sec); i += 1; end' ./miniruby --disable-gem 0.23s user 0.00s system 99% cpu 0.233 total git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c: [DOC] Time#localtimenobu2018-07-021-0/+3
| | | | | | | * time.c: state that Time#localtime does nothing when nothing changes. [ruby-core:87675] [Bug #14880] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c (num_exact): use predefined IDsnormal2018-01-221-2/+2
| | | | | | | No need to waste space on "to_r" and "to_int" which are predefined in defs/id.def git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c: constify compat_* tablesnormal2018-01-221-2/+2
| | | | | | | compat_common_month_table and compat_leap_month_table should not be writable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c: use "unsigned int" for bitfieldsnormal2018-01-171-8/+2
| | | | | | Followup to r61870 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* internal.h: remove dependecy on ruby/encoding.hnobu2018-01-091-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bit-fields other than int is a C99ismshyouhei2018-01-021-2/+8
| | | | | | | To be precise C90 says "A bit-field may have type int, unsigned int, or signed int". It is clear that char or enum are NG. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* extern rb_time_utc_offset to get utc offsetnaruse2017-12-111-8/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Time#at receives 3rd argument which specifies the unit of 2nd argument ↵naruse2017-09-251-9/+38
| | | | | | [Feature #13919] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c (Time#-): Fix documentation.eregon2017-09-141-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e