summaryrefslogtreecommitdiff
path: root/strftime.c
AgeCommit message (Collapse)Author
2017-05-10adjust styles [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-29vsnprintf.c: prefix with precisionnobu
* vsnprintf.c (BSD_vfprintf): sign and hex-prefix should not be counted in precision. [ruby-dev:47714] [Bug #8916] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-17deduplicate static rb_str_format format stringsnormal
Anybody who hits these code paths can hit them again in the future, so try deduplicating across multiple runs of these methods to reduce garbage. * string.c (str_upto_each): fstring on "%.*d" * strftime.c (rb_strftime_with_timespec): fstring on "%0*d" git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14strftime.c: limit result sizenobu
* strftime.c (rb_strftime_with_timespec): limit the result string size by the format length, to get rid of unlimited memory use. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-24strftime.c: Bignum conversionnobu
* strftime.c (format_value): convert from Bignum to String, instead of rb_str_format. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-24strftime.c: set buffer lengthnobu
* strftime.c (FMTV): set the buffer length before appending to keep just put part. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-24strftime.c: refine r54248nobu
* strftime.c (FMT_PRECISION): eliminate side effects. [Bug #12213] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-24strftime.c: remove recursive-assignmentsnobu
* strftime.c (FMT, FMTV): remove recursive-assignments to get rid of undefined behavior. [ruby-core:74532] [Bug #12213] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-24strftime.c: fix FMTVnobu
* strftime.c (FMT_PADDING): extract format for padding. * strftime.c (FMT_PRECISION): extract precision formula. * strftime.c (FMTV): append formatted string to expand the result. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-24strftime.c: case conversionnobu
* strftime.c (STRFTIME): deal with case conversion flags for recursive formats. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-24strftime.c: fix false failurenobu
* strftime.c (rb_strftime_with_timespec): remove unnecessary check, as `s` equals to `endp` when recursed STRFTIME resized the capacity same as the size. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-23strftime.c: format in Stringnobu
* 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
2013-04-06* strftime.c (rb_strftime_with_timespec): Test yday range.akr
[ruby-core:44088] [Bug #6247] reported by Ruby Submit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-16unecessary macros and K&R style codingnobu
* strftime.c: remove unnecessary macros to check traditional C. https://github.com/ruby/ruby/pull/46 by lateau (Daehyub Kim). * vsnprintf.c: remove K&R. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-29strftime.c: triple colons modifiernobu
partially borrowed from ext/date. * strftime.c (rb_strftime_with_timespec): support GNU extension triple colons modifier. [EXPERIMENTAL] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-29strftime.c: fix locale modifiernobu
partially borrowed from ext/date. * strftime.c (rb_strftime_with_timespec): check conversion with locale modifier. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-29strftime.c: fix colon modifier.nobu
partially borrowed from ext/date. * strftime.c (rb_strftime_with_timespec): colons are valid only for 'z' and must come just before it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-28strftime.c: linux stylenobu
* strftime.c (rb_strftime_with_timespec): fix indentation using linux style. this file is not written in ruby-style. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-19* strftime.c (rb_strftime_with_timespec): fix carrir-up bug andnobu
overwrite '+' with '-' if negative offset less than a hour. [ruby-core:44447][Bug #6323] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-18* strftime.c (rb_strftime_with_timespec): add an interim digit fornobu
the timezone offset which is less than an hour. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-17* strftime.c (rb_strftime_with_timespec): fix padding of time zonenobu
offset. [ruby-dev:43287][Bug #4458] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-27* strftime.c (rb_strftime_with_timespec): get enc argument to specifynaruse
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-07-30* strftime.c (NEEDS): avoid SEGV due to integer overflow in sparc-solaris2.10ngoto
and i686-linux. fix [Bug #4456] [ruby-dev:43284] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-31* strftime.c (rb_strftime_with_timespec): improved style consistency.yugui
constified some variables. * test/test_time.rb (TestTime#test_huge_precision): test for #4456. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-25* random.c (random_rand): remove unused variables.naruse
* struct.c (rb_struct_define_without_accessor): ditto. * strftime.c (rb_strftime_with_timespec): ditto. * sprintf.c: ditto. * time.c (time_asctime): remove useless GetTimeval(). * thread_pthread.c: cast to (void *) for %p. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07cancel subversion backfire. sorrymatz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07* gc.c (rb_gc_set_params): allow GC parameter configuration bymatz
environment variables. based on a patch from funny-falcon at https://gist.github.com/856296, but honors safe level. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-03* strftime.c (STRFTIME): return 0 and ERANGE when precision is toonaruse
large. [ruby-dev:43284] fixes #4456 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-30* strftime.c (rb_strftime_with_timespec): %G produces 4 digits.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-01* strftime.c: parenthesize macro arguments.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-08* strftime.c (rb_strftime_with_timespec): suppress warnings.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-10* strftime.c (rb_strftime_with_timespec): fix precision handling forakr
%:z and %::z. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-09* strftime.c: unused declarations removed.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-09* strftime.c (rb_strftime_with_timespec): clear colons at unknownakr
directive. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-09* strftime.c: don't call tzset. strftime.c doesn't depend onakr
the global timezone. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-08unused code removed.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-07* strftime.c (rb_strftime_with_timespec): support %:z and %::z.akr
[ruby-dev:41841] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-31* time.c: less bignum allocations.akr
* strftime.c (rb_strftime_timespec): defined to avoid rational for nano second resolution time. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-25* bignum.c, node.h, strftime.c, enc/trans/utf8_mac.trans: added explicit ↵muraken
casts for supplessing warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-06* strftime.c: %l should be 1..12 instead of 0..12 [ruby-core:27072]naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-26* removed spaces just before tabs.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-24* strftime.c: %Y format a year with 4 digits at least.akr
* lib/time.rb: format a year with 4 digits at least. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03fix typos.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-12* time.c: support fixed UTC offset. [ruby-dev:38326]akr
(leap_year_v_p): new macro. (TIME_FIXOFF_P): new macro. (TIME_SET_FIXOFF): new macro. (time_init_0): renamed from time_init. (time_set_utc_offset): new function. (vtm_add_offset): new function. (utc_offset_arg): new function. (time_init_1): new function. (time_init): call time_init_0 or time_init_1 according argc. (validate_utc_offset): new function. (time_localtime_m): new function. (time_fixoff): new function. (time_getlocaltime): take optional UTC offset argument. (time_get_tm): support fixed UTC offset time. (Init_Time): make Time#{initialize,localtime,getlocal} varargs. * strftime.c (rb_strftime): vtm->zone can be NULL now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-22* time.c (localtime_with_gmtoff): fixed cross function jump.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-21* time.c: remove time_t restriction from Time class.akr
* timev.h: new file to define struct vtm. * strftime.c: format struct vtm instead of struct tm. * ext/syck/rubyext.c (mktime_do): don't use time_t; [ruby-dev:38191] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-17* dir.c, dln.c, parse.y, re.c, ruby.c, sprintf.c, strftime.c,nobu
string.c, util.c, variable.c: use strlcpy, memcpy and snprintf instead of strcpy, strncpy and sprintf. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-12* array.c, bignum.c, dln.c, error.c, gc.c, io.c, marshal.c,nobu
numeric.c, pack.c, strftime.c, string.c, thread.c, transcode.c, transcode_data.h, util.c, variable.c, vm_dump.c, include/ruby/encoding.h, missing/crypt.c, missing/vsnprintf.c: suppress VC type warnings. [ruby-core:22726] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22stripped trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-23* strftime.c (rb_strftime): use locale insensitive functions for tr_TRakr
locale. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e