summaryrefslogtreecommitdiff
path: root/time.c
AgeCommit message (Collapse)Author
2014-09-21* time.c: raise exception when minutes of utc_offset is out of 00-59.glass
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
2014-09-10time.c: DATA_PTR is never NULLnormal
* 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
2014-08-26* time.c (rb_time_unmagnify_to_float): Avoid double rounding.akr
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
2014-08-16time.c (time_timespec): fix tv_nsec overflownormal
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
2014-08-14Revert r46977. [ruby-core:63857] [Bug #10071]akr
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
2014-07-27* time.c: [DOC] Clarify %Y in strftime, which can accept any digitszzak
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
2014-07-27* time.c: [DOC] Remove dead link and old bug report, which hasn't beenzzak
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
2014-07-23time.c: unnecessary encodingnobu
* 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
2014-05-11* compile.c (BUFSIZE): Unused macro removed.akr
* 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
2014-05-02time.c: fix underflow of unsigned integersnobu
* time.c (vtm_add_offset): get rid of underflow of unsigned integers. fix up r45155. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-18time.c: fix non-terminated stringnobu
* time.c (month_arg, time_strftime): RSTRING_PTR() may not be NUL-terminated. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-19time.c: freeze and preserve marshal-loaded time zonenormal
We need to prevent vtm.zone from pointing to a GC-ed string buffer. The rb_copy_generic_ivar call misses it because get_attr deleted it. Thanks to nobu for the rb_str_new_frozen suggestion. * time.c (time_mload): freeze and preserve marshal-loaded time zone * test/ruby/test_time.rb: add test for GC on loaded object [Bug #9652] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-14[DOC] add links to `Object#hash`nobu
add links to `Object#hash` to each #`hash` methods rdocs. [Fixes GH-567] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-28[DOC]akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-27adjust indent and stylenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-25configure.in, win32/Makefile.sub: PACKED_STRUCT with VCnobu
* configure.in (PACKED_STRUCT): check VC pragma too, and make function-style macro. * win32/Makefile.sub (PACKED_STRUCT): enable with VC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-24time: only use packed struct on x86*normal
* configure.in: define PACKED_STRUCT_UNALIGNED for x86* * timev.h (struct vtm): use PACKED_STRUCT_UNALIGNED * time.c (struct time_object): ditto [Bug #9558] non-x86 cannot safely access unaligned addresses git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-24time: rearrange+pack vtm and time_object structsnormal
struct time_object shrinks from 88 to 46 bytes on my 64-bit system. * configure.in: use -Wno-packed-bitfield-compat for GCC 4.4+ use __attribute__((packed)) if available * timev.h: shrink and pack struct vtm * time.c: pack struct time_object and adjust/introduce helpers [ruby-core:60794] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-30* time.c (v2w): Normalize a rational value to an integer if possible.akr
[ruby-core:58070] [Bug #9059] reported by Isaac Schwabacher. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29* add RUBY_TYPED_FREE_IMMEDIATELY to data types which only useko1
safe functions during garbage collection such as xfree(). On default, T_DATA objects are freed at same points as fianlizers. This approach protects issues such as reported by [ruby-dev:35578]. However, freeing T_DATA objects immediately helps heap usage. Most of T_DATA (in other words, most of dfree functions) are safe. However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default for safety. * cont.c: ditto. * dir.c: ditto. * encoding.c: ditto. * enumerator.c: ditto. * error.c: ditto. * file.c: ditto. * gc.c: ditto. * io.c: ditto. * iseq.c: ditto. * marshal.c: ditto. * parse.y: ditto. * proc.c: ditto. * process.c: ditto. * random.c: ditto. * thread.c: ditto. * time.c: ditto. * transcode.c: ditto. * variable.c: ditto. * vm.c: ditto. * vm_backtrace.c: ditto. * vm_trace.c: ditto. * ext/bigdecimal/bigdecimal.c: ditto. * ext/objspace/objspace.c: ditto. * ext/stringio/stringio.c: ditto. * ext/strscan/strscan.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-09* process.c: Remove spaces between SI prefix and unit to followakr
SI brochure. http://www.bipm.org/en/si/si_brochure/ https://www.nmij.jp/library/units/si/ * time.c: Ditto. * ext/socket/ancdata.c: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-17time.c: ignore invalid datanobu
* time.c (time_mload): ignore invalid offset and zone. [ruby-core:56648] [Bug #8795] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-09* time.c (get_timeval, get_new_timeval): use rb_obj_class()ktsj
instead of CLASS_OF() because CLASS_OF() may return a singleton class. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-08* time.c (time_overflow_p): Avoid signed integer overflow.akr
(rb_time_new): Fix overflow condition. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-08Fix the previous commit.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-08* time.c (time_overflow_p): Avoid signed integer overflow.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-06* time.c: [DOC] Typo in Time overview by @sparr [Fixes GH-374]zzak
https://github.com/ruby/ruby/pull/374 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-11Unused variable removed.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-11* bignum.c (validate_integer_pack_format): Don't require a word orderakr
flag if numwords is 1 or less. (absint_numwords_generic): Don't specify a word order for rb_integer_pack. * hash.c (rb_hash): Ditto. * time.c (v2w_bignum): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-10* bignum.c (rb_integer_pack): Returns sign instead of words.akr
(absint_numwords_generic): Follow the above change. (big2str_base_powerof2): Follow the above change. * internal.h: Ditto. * hash.c (rb_hash): Ditto. * pack.c (pack_pack): Ditto. * random.c (int_pair_to_real_inclusive): Ditto. (rand_init): Ditto. (random_load): Ditto. (limited_big_rand): Ditto. * time.c (v2w_bignum): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-09* bignum.c (rb_integer_pack): numwords_allocated argument removed.akr
* internal.h (rb_integer_pack): Follow the above change. * hash.c (rb_hash): Ditto. * time.c (v2w_bignum): Ditto. * pack.c (pack_pack): Ditto. * random.c (int_pair_to_real_inclusive): Ditto. (rand_init): Ditto. (random_load): Ditto. (limited_big_rand): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-08* time.c (v2w): Use rb_absint_size instead of RBIGNUM_LEN.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-08* time.c (v2w_bignum): Simplified using rb_integer_pack.akr
(rb_big_abs_find_maxbit): Removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-08* bignum.c (rb_absint_singlebit_p): New function.akr
* internal.h (rb_absint_singlebit_p): Declared. * time.c (v2w_bignum): Use rb_absint_singlebit_p instead of rb_big_abs_find_minbit. (rb_big_abs_find_minbit): Removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-08* time.c (rb_big_abs_find_maxbit): Use rb_absint_size.akr
(bdigit_find_maxbit): Removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-19fix typos. Patch by k_takata.ktsj
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-01* time.c (localtime_with_gmtoff_zone): musl libc may return NULL forakr
tm_zone. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04* time.c (time_strftime): Describe %L and %N truncates digits underakr
the specified length. [ruby-core:52130] [Bug #7829] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-30timev.h: move time_t stuffsnobu
* timev.h (TYPEOF_TIMEVAL_TV_SEC, unsigned_time_t): move from time.c. * thread.c: use definitions in timev.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-30thread.c: format specifiers for time_tnobu
* thread.c (sleep_timeval): fix format specifiers for time_t. * time.c (DEBUG_REPORT_GUESSRANGE): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-27* time.c (num_exact): use to_r method only if to_int method isakr
available. [ruby-core:53764] [Bug #8173] reported by Hiro Asari. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-26* internal.h: Define TIMET_MAX and TIMET_MIN here.akr
* time.c: Remove TIMET_MAX and TIMET_MIN definitions. * thread.c: Ditto. * thread_pthread.c: Remove TIMET_MAX definition. * thread_win32.c: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-26update doc.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-16* configure.in: check struct timeval exist or not.kosaki
* include/ruby/missing.h (struct timeval): check HAVE_STRUCT_TIMEVAL properly. and don't include sys/time.h if struct timeval exist. * file.c: include sys/time.h explicitly. * random.c: ditto. * thread_pthread.c: ditto. * time.c: ditto. * ext/date/date_strftime.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-15time.c: check re-initializenobu
* time.c (GetTimeval): check if already initialized instance. * time.c (GetNewTimeval): check if newly created instance. * time.c (time_init_0, time_init_1, time_init_copy, time_mload): must be newly created instance. [ruby-core:53436] [Bug #8099] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-23* array.c: Document #<=> return values and formattingzzak
* bignum.c: ditto * file.c: ditto * object.c: ditto * numeric.c: ditto * rational.c: ditto * string.c: ditto * time.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-17compar.c: inversed comarison without infinite recursionnobu
* compar.c (rb_invcmp): compare by inversed comarison, with preventing from infinite recursion. [ruby-core:52305] [Bug #7870] * string.c (rb_str_cmp_m), time.c (time_cmp): get rid of infinite recursion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-12time.c: st_updatenobu
* time.c (zone_str): lookup or insert by using st_update() at once. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-07* time.c (time_mdump): dump timezone string to private instance variablenaruse
on marshaling. * time.c (time_mload): load timezone string from private instance variable named 'zone'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01time.c, vm_method.c: update rdocnobu
* time.c (time_{mdump,dump,mload,load): update rdoc. * vm_method.c (obj_respond_to_missing): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e