Граф коммитов

355 Коммитов

Автор SHA1 Сообщение Дата
akr a4460ddb48 * time.c (localtime_with_gmtoff_zone): musl libc may return NULL for
tm_zone.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-01 12:12:25 +00:00
akr f674d8623d * time.c (time_strftime): Describe %L and %N truncates digits under
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-04-04 13:37:22 +00:00
nobu 77ff241fa0 timev.h: move time_t stuffs
* 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-30 21:08:36 +00:00
nobu f2e1bfb897 thread.c: format specifiers for time_t
* 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-30 21:08:34 +00:00
akr c64f26a281 * time.c (num_exact): use to_r method only if to_int method is
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-27 11:37:59 +00:00
akr bfb0edbad2 * internal.h: Define TIMET_MAX and TIMET_MIN here.
* 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-26 14:45:55 +00:00
akr e1540cd74d update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-26 12:22:12 +00:00
kosaki 798ff850e4 * configure.in: check struct timeval exist or not.
* 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-16 05:06:47 +00:00
nobu 84085167f8 time.c: check re-initialize
* 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-03-15 14:06:21 +00:00
zzak c2204ca328 * array.c: Document #<=> return values and formatting
* 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-23 03:35:38 +00:00
nobu 44c5c2a312 compar.c: inversed comarison without infinite recursion
* 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
2013-02-17 11:55:50 +00:00
nobu a773539d3a time.c: st_update
* 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-12 09:27:12 +00:00
naruse 1bb1d096fb * time.c (time_mdump): dump timezone string to private instance variable
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-07 02:55:35 +00:00
nobu 3faee6520e time.c, vm_method.c: update rdoc
* 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
2012-12-01 13:54:54 +00:00
nobu 9c1b3161f2 complex.c, time.c: make marshal methods private
* complex.c (Init_Complex), time.c (Init_Time): make marshal methods
  private.  [Feature #6539]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01 09:17:02 +00:00
zzak 088b04e8a4 * time.c: Documentation improvements, grammar and formatting
Patch by Bernd Homuth [ruby-core:49203] [Bug #7326]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30 04:53:09 +00:00
drbrain b773a4f803 * time.c (time_sec): Remove extra wording about leap seconds and refer
directly to Wikipedia's leap second page for further information.
  [Bug #6749]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-30 21:18:29 +00:00
drbrain 0d8bc52593 * time.c (time_sec): Updated description of leap seconds for accuracy.
Based on patch by Marcus Stollsteimer.  [Bug #6749]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-23 22:23:41 +00:00
akr 83eceb2a79 * time.c (timew_out_of_timet_range): specialization for
SIZEOF_TIME_T == SIZEOF_INT64_T.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-02 12:26:50 +00:00
kosaki 51c44ab1ec * time.c (init_leap_second_info): fix non-ANSI function declaration.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-19 21:50:32 +00:00
nobu 2073258a7d obj_init_copy
* object.c (rb_obj_init_copy): should check if trusted too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 11:13:18 +00:00
nobu 18805586d9 utc offset in seconds
* time.c (utc_offset_arg): utc offset can be precision in seconds.
  e.g. old Europe/Lisbon (c.f. [ruby-dev:40066])


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-30 01:58:34 +00:00
tadf 43e8bf0c27 re-modified
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-26 09:21:21 +00:00
tadf 0976f31200 * time.c: modified doc.
* ext/date/date_core.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-26 09:10:42 +00:00
nobu 28e48d3fd8 * time.c (time_init_1): Time.new will accept seconds as string or
int.  [ruby-core:43569][Bug #6193]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-24 13:22:22 +00:00
akr c7c91247e2 typo fix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-09 19:21:01 +00:00
akr 4dbafb0d89 update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-09 18:54:12 +00:00
nobu 80429eed63 * io.c, process.c, time.c, ext: use rb_sys_fail_str instead of
rb_sys_fail.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-27 01:50:27 +00:00
akr 3ab9be9245 update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-11 16:48:04 +00:00
akr 4e8d188ead update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-11 16:28:13 +00:00
akr 62fed7c91a update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-19 10:48:22 +00:00
akr 6445aab472 * time.c (TIME_COPY_GMT): copy vtm.utc_offset and vtm.zone too.
patch by Tomoyuki Chikanaga.
  [ruby-dev:44827] [Bug #5586]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-19 10:47:03 +00:00
nobu 413f24d3b0 * whitespace cleanup.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-04 07:19:23 +00:00
drbrain 9edfa89744 * time.c (Init_Time): Remove editorial comments from Time
documentation, fix link.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-06 00:17:41 +00:00
drbrain 0d900cecdf * time.c (Init_Time): Improve Time documentation. Patch by Shane
Emmons.  [Ruby 1.9 - Bug #5404]
* lib/time.rb:  Improve time.rb documentation including Time.strptime.
  Patch by Shane Emmons.  [Ruby 1.9 - Bug #5402]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-06 00:14:55 +00:00
nobu 8e6e8e6288 * use RB_TYPE_P which is optimized for constant types, instead of
comparison with TYPE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29 11:07:45 +00:00
akr cf7d76f0bc update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33241 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-09 23:14:00 +00:00
naruse 6bc83a18b7 * internal.h (rb_strftime_timespec): moved from time.c and define only
if ruby/encoding.h is included.

* internal.h (rb_strftime): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-27 10:06:25 +00:00
naruse 7412263eba * internal.h (rb_strftime_timespec): move to time.c because it depends
encoding.h.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-27 09:45:15 +00:00
naruse 23b2808693 * strftime.c (rb_strftime_with_timespec): get enc argument to specify
the encoding of the format. On Windows (at least Japanese Windows),
  Time#strftime("%Z") includes non ASCII in locale encoding (CP932).
  So convert locale to default internal. [ruby-core:39092] [Bug #5226]

* strftime.c (rb_strftime): ditto.

* strftime.c (rb_strftime_timespec): ditto.

* internal.h (rb_strftime_timespec): follow above.

* time.c (rb_strftime_alloc): ditto.

* time.c (strftimev): ditto.

* time.c (time_strftime): ditto.

* time.c (time_to_s): the resulted string of Time#to_s is always
  ascii only, so this should be US-ASCII.

* time.c (time_asctime): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-27 09:18:18 +00:00
tenderlove 4544b3824c * time.c (strftimev): Make Time#to_s default to US-ASCII encoding but
respect Encoding.default_internal. [ruby-core:39092]
* test/ruby/test_time.rb (class TestTime): Corresponding test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-25 23:24:33 +00:00
akr 2fa6ebc64d update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-25 16:39:37 +00:00
kosaki f2f14f572d * time.c (rb_strftime_alloc): raise ERANGE if width is too large.
Patch by Nobuyoshi Nakada. [Bug #4457] [ruby-dev:43285]

* test/ruby/test_time.rb (class TestTime): add a test for the
  above change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-07 14:38:17 +00:00
nobu e2fd80b3d3 * error.c (rb_check_trusted): new function to check an object is
trusted.
* struct.c (rb_struct_modify), time.c (time_modify): check by the
  above function to show proper class names.  [Bug #5036]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-17 07:26:45 +00:00
kosaki 6270ce85ed * time.c (time_dup): used rb_obj_class() instead of CLASS_OF().
The patch is made by Kazuki Tsujimoto. [Bug #5012] [ruby-dev:44071]

* test/ruby/test_time.rb (TestTime#test_getlocal_dont_share_eigenclass):
  added a new test for eigenclass of time object.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-15 16:06:53 +00:00
kanemoto 2a5aa8cdaa time.c: can't compile time.c on AIX due to missing declaration for
ffs(). It is declared in strings.h on AIX.
        
        If I need to add something like '&& defined(_AIX)',
        please let me know.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-11 14:29:45 +00:00
akr 5ed8c08aa0 * eval.c, hash.c, load.c, proc.c, range.c, thread.c, time.c: don't
declare internal functions.

* internal.h, vm_core.h: declare internal functions.

* array.c: include internal.h.

* common.mk: update dependency for array.o.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 08:26:19 +00:00
akr afd7e4668f * internal.h: declare more internal functions.
* iseq.h (rb_method_get_iseq): declared.

* compile.c, eval.c, eval_error.c, iseq.c, parse.y, proc.c, range.c,
  ruby.c, time.c, util.c, vm.c: don't declare internal functions.

* eval.c, parse.y, thread_pthread.c: non-existing function declarations
  removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 01:54:57 +00:00
akr e7996eb3cc * internal.h: declare internal functions here.
* node.h: declare NODE dependent internal functions here.

* iseq.h: declare rb_iseq_t dependent internal functions here.

* vm_core.h: declare rb_thread_t dependent internal functions here.

* bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c,
  enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c,
  iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y,
  proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c,
  thread.c, time.c, transcode.c, variable.c, vm.c,
  tool/compile_prelude.rb: don't declare internal functions declared
  in above headers.  include above headers if required.

  Note that rb_thread_mark() was declared as
  void rb_thread_mark(rb_thread_t *th) in cont.c but defined as
  void rb_thread_mark(void *ptr) in vm.c.  Now it is declared as
  the later in internal.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 22:43:38 +00:00
naruse f45d127ada * time.c (rb_time_new): prevent overflow by "* 1000".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-16 19:46:08 +00:00