aboutsummaryrefslogtreecommitdiffstats
path: root/time.c
Commit message (Collapse)AuthorAgeFilesLines
* replace fixnum by integer in documents.akr2016-09-081-14/+14
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c (obj2subsecx): subsec might be GC'ed. try to get rid of SEGV on mswinusa2016-09-061-0/+1
| | | | | | | CI. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c (time_arg): revert r55688 beause it had no effect. retry...usa2016-07-151-1/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c (time_arg): it seems that this function sometimes causes SEGVusa2016-07-151-0/+1
| | | | | | | | on mswin CI, then force to prevent `vtm->subsecx` from GC. this is experimental. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c: define _DEFAULT_SOURCE because glibc 2.20 depracatesnaruse2016-04-271-0/+1
| | | | | | | _BSD_SOURCE. https://sourceware.org/glibc/wiki/Release/2.20 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c: add example [ci skip]nobu2016-04-221-0/+1
| | | | | | | * time.c (time_asctime): [DOC] add ctime example, not only asctime. [ruby-core:75126] [Bug #12310] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* strftime.c: format in Stringnobu2016-03-231-70/+17
| | | | | | | | | | | | * strftime.c (rb_strftime_with_timespec): append formatted results to the given string with expanding, and also deal with NUL chars. * strftime.c (rb_strftime, rb_strftime_timespec): return formatted string, not the length put in the given buffer. * time.c (rb_strftime_alloc): no longer needs to retry with reallocating buffers. * time.c (time_strftime): no longer needs to split by NUL chars. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c (wmul): wrong condition.usa2016-03-221-1/+1
| | | | | | | fixed many test failures on 32bit and LLP64 platforms. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c (wdiv, wmod): wdivmod0() assumes the 3rd and the 4th argumentsusa2016-03-221-4/+4
| | | | | | | | | | | are valid pointers. maybe checking them in wdivmod0() is better manner, but I guess that passing real dummy pointers may be faster than checking and branching in wdivmod0(). this commit fixes SEGV on 32bit and LLP64 platforms. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c (divmodv): void function never returns any value.usa2016-03-221-1/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix typonaruse2016-03-211-4/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c (MUL_OVERFLOW_FIXWV_P): defined for FIXWV.naruse2016-03-211-67/+4
| | | | | | | | | | | | | * time.c (wmul): use MUL_OVERFLOW_FIXWV_P and only switch. * time.c (wmul): use mul which has Fixnum optimization. * time.c (rb_time_magnify): If WIDEVALUE_IS_WIDER, wmul() has the same optimized logic, else mul() has also the similar logic for Fixnum. * time.c (rb_time_unmagnify): almost ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix typonaruse2016-03-211-4/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c (divmodv): add the case both arguments are Fixnum.naruse2016-03-211-57/+40
| | | | | | | | | | | | | | | | | * time.c (wquo): use quo which has Fixnum optimization. * time.c (wdivmod0): added for WIDEVALUE_IS_WIDER. * time.c (wdivmod): use wdivmod0 and divmodv. divmodv has Fixnum optimization. * time.c (wdiv): use wdivmod0 and div to avoid the use of divmodv which calls id_quo whose return value is array. * time.c (wmod): use wdivmod0 and mod to avoid the use of divmodv which calls id_quo whose return value is array. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h (rb_fix_divmod_fix): like r54213, use FIX2NUM only ifnaruse2016-03-211-1/+1
| | | | | | | x == FIXNUM_MIN && y == -1. This must be a rare case and it is expected compiler to handle well. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c (quo): fix missing returnnobu2016-03-211-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix commit missnaruse2016-03-211-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c (mod): Add Fixnum case.naruse2016-03-211-5/+8
| | | | | | | * time.c (quo): c can be Fixnum except a == FIXNUM_MIN && b == -1. Such case can be optimized out because quo()'s argument is constant. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c (mul): fix missing return.nobu2016-03-201-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h (DLONG): defined if long is 32bit (and LONG_LONG is 64bit;naruse2016-03-201-51/+1
| | | | | | | | | | | | | | | | but LONG_LONG is always defined as 64bit), or there's int128_t. * internal.h (DL2NUM): defined if DLONG is defined. * internal.h (rb_fix_mul_fix): defined for `Fixnum * Fixnum`. * insns.def (opt_mul): use rb_fix_mul_fix(). * numeric.c (fix_mul): ditto. * time.c (mul): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c (add): remove FIXABLE() which is in LONG2NUM().naruse2016-03-201-10/+3
| | | | | | | | * time.c (sub): ditto. * time.c (mul): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c (LOCALTIME): organize #ifdefs.naruse2016-03-181-36/+22
| | | | | | * time.c (GMTIME): define only ifndef HAVE_STRUCT_TM_TM_GMTOFF. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * configure.in (rb_cv_member_struct_tm_tm_gmtoff): For Linux (glibc)naruse2016-03-181-0/+1
| | | | | | | | define _BSD_SOURCE for time.h to define struct tm.tm_gmtoff. * time.c: define _BSD_SOURCE at the top. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c: Minor typo in Time#dst? documentation.hsbt2016-03-151-1/+1
| | | | | | [ci skip][fix GH-1290] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c (rb_time_timespec_new): swap utc and localtimenaruse2015-11-101-4/+4
| | | | | | to generate gmt flag by INT_MAX - gmtoff. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c (rb_timespec_now): added.naruse2015-11-101-13/+48
| | | | | | * time.c (rb_time_timespec_new): added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix comment: tobj->gmt is 0:localtime 1:utc 2:fixoff 3:initnaruse2015-11-091-1/+1
| | | | | | see also TIME_UTC_P and TIME_LOCALTIME_P git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* preserve encodings in error messagesnobu2015-09-281-9/+11
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c (time_getlocaltime): [DOC] Add examples of valid utc_offsetakr2015-06-141-0/+6
| | | | | | | | | formats. [ruby-core:68306] [Misc #10905] Patch by Charles Korn. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* variable.c: avoid compatibility table with generic ivarsnormal2015-05-301-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This recovers and improves performance of Marshal.dump/load on Time objects compared to when we implemented generic ivars entirely using st_table. This also recovers some performance on other generic ivar objects, but does not bring bring Marshal.dump/load performance up to previous speeds. benchmark results: minimum results in each 10 measurements. Execution time (sec) name trunk geniv after marshal_dump_flo 0.343 0.334 0.335 marshal_dump_load_geniv 0.487 0.527 0.495 marshal_dump_load_time 1.262 1.401 1.257 Speedup ratio: compare with the result of `trunk' (greater is better) name geniv after marshal_dump_flo 1.026 1.023 marshal_dump_load_geniv 0.925 0.985 marshal_dump_load_time 0.901 1.004 * include/ruby/intern.h (rb_generic_ivar_table): deprecate * internal.h (rb_attr_delete): declare * marshal.c (has_ivars): use rb_ivar_foreach (w_ivar): ditto (w_object): update for new interface * time.c (time_mload): use rb_attr_delete * variable.c (generic_ivar_delete): implement (rb_ivar_delete): ditto (rb_attr_delete): ditto [ruby-core:69323] [Feature #11170] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * win32/Makefile.sub: MSVC14 have struct timespec.naruse2015-04-231-0/+4
| | | | | | | | | * win32/rtname.cmd: support vcruntime140.dll. * time.c (localtime_with_gmtoff_zone): MSVC14 doesn't have tzname and daylight but have _tzname and _daylight. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c: locale time zone namenobu2015-02-241-1/+4
| | | | | | | * time.c (time_zone_name): should be US-ASCII only if all 7-bits, otherwise locale encoding. [ruby-core:68230] [Bug #10887] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* zone may be ASCII-8BIT on Windows [Bug #10887]naruse2015-02-231-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c: zone encoding should be US-ASCII if all 7-bits. Fix r46907.eregon2015-02-221-1/+1
| | | | | | * test/ruby/test_time.rb, test/ruby/test_time_tz.rb: Update tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c (timelocalw): Set tm_isdst field -1 if vtm->isdst isakr2015-01-061-1/+1
| | | | | | | | | | VTM_ISDST_INITVAL. This bug is introduced at packing struct vtm (r45155). [ruby-core:67345] [Bug #10698] Reported by Boris Ruf. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use 0 for reservednobu2014-12-011-1/+1
| | | | | | | use 0 for rb_data_type_t::reserved instead of NULL, since its type may be changed in the future and possibly not a pointer type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c: indentnobu2014-11-271-30/+30
| | | | | | * time.c (find_time_t): adjust indent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c (time_s_mkutc): [DOC] Time.utc's 10 arguments formakr2014-11-271-4/+4
| | | | | | | | | | | doesn't examine wday, yday, isdst and tz. (time_s_mktime): [DOC] Time.mktime's 10 arguments form doesn't examine wday, yday and tz. Suggested by naruse. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: Include ruby.h and ruby/encoding.h to beakr2014-11-151-3/+1
| | | | | | | | includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update doc.akr2014-11-041-7/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * Avoid undefined behaviors found by gcc -fsanitize=undefined.akr2014-10-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | gcc (Debian 4.9.1-16) 4.9.1 * include/ruby/ruby.h (INT2FIX): Avoid undefined behavior. * node.h (nd_set_line): Ditto. * pack.c (encodes): Ditto. (pack_unpack): Ditto. * regint.h (BIT_STATUS_AT): Ditto. (BS_BIT): Ditto. * time.c (time_mdump): Ditto. (time_mload): Ditto. * vm_core.h (VM_FRAME_MAGIC_MASK): Ditto. * vm_trace.c (recalc_add_ruby_vm_event_flags): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c: raise exception when minutes of utc_offset is out of 00-59.glass2014-09-211-0/+1
| | | | | | | | | | patch is from Kenichi Kamiya. [ruby-dev:47539] [Bug #8679] * test/ruby/test_time.rb: test for above. patch is from Kenichi Kamiya. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c: DATA_PTR is never NULLnormal2014-09-101-9/+2
| | | | | | | | | | | | | | * time.c (time_mark): remove NULL check (time_memsize): ditto (time_free): remove, use RUBY_TYPED_DEFAULT_FREE instead [Feature #10219] Tiny improvement on my old Phenom II X4 945 system: $ ruby --disable=gems -e '6000000.times { Time.now }' before: 2.51user 0.00system 0:02.51elapsed 100%CPU after: 2.45user 0.00system 0:02.45elapsed 100%CPU git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c (rb_time_unmagnify_to_float): Avoid double rounding.akr2014-08-261-1/+4
| | | | | | | | | Reported by Tsuyoshi Sawada. https://bugs.ruby-lang.org/issues/10135#note-1 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c (time_timespec): fix tv_nsec overflownormal2014-08-161-0/+4
| | | | | | | | | | | | test/ruby/test_float.rb (test_sleep_with_Float) causes tv_nsec to hit 1000000000 exactly. This bug is currently hidden from our test by the platform-dependent native_cond_timeout functions, but a future native_cond_timedwait implementation may prefer relative timeouts to match ConditionVariable#wait semantics more closely. [Bug #10144] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert r46977. [ruby-core:63857] [Bug #10071]akr2014-08-141-2/+6
| | | | | | | | | | | | The removed comment is useful to understand the behind idea to solve the year 2038 problem. The broken link is replaced to refer the internet archive. https://github.com/ruby/ruby/commit/0eed69757dd2bc0eb460a5dc38e377ac8e2cbfd9#commitcomment-7166665 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c: [DOC] Clarify %Y in strftime, which can accept any digitszzak2014-07-271-1/+1
| | | | | | | | and will output at least 4 digits as the year. Reported by Yury Trofimenko [Bug #8941] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c: [DOC] Remove dead link and old bug report, which hasn't beenzzak2014-07-271-6/+2
| | | | | | | reproduced in a few years. Reported by Federico Builes [Bug #10071] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c: unnecessary encodingnobu2014-07-231-3/+14
| | | | | | | * time.c (time_zone_name): remove unnecessary encoding and conversion if it is 7bit-ascii only. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compile.c (BUFSIZE): Unused macro removed.akr2014-05-111-5/+1
| | | | | | | | | | | | | | | | * vm.c (BUFSIZE): Ditto. * pack.c (INT64toNUM): Ditto. (UINT64toNUM): Ditto. (BYTEWIDTH): Ditto. * time.c (lshift): Ditto. (UINT64toNUM): Ditto. (id_lshift): Unused variable removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e