summaryrefslogtreecommitdiff
path: root/strftime.c
AgeCommit message (Collapse)Author
2018-10-13Prefer `rb_fstring_lit` over `rb_fstring_cstr`nobu
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
2018-10-08revert r64957 [ci skip]k0kubun
r64956 didn't work either... This means that svn.ruby-lang.org/ruby is not executing the latest git hook on git.ruby-lang.org/ruby-commit-hook. Tentatively I backported the changes of auto-style.rb in git.ruby-lang.org/ruby-commit-hook to git.ruby-lang.org/scripts. I hope this commit won't be rolled back by svn bot... git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-08* expand tabs.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-08revert r64955k0kubun
r64954 didn't work... In this commit, I'm experimenting https://git.ruby-lang.org/ruby-commit-hook.git/commit/svn-utils/bin/auto-style.rb?id=2a1a17da1c163e8fc4321759d95057441ddf2c0a We can distinguish possible 2 issues by this commit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-08* expand tabs.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-08partially revert r64953k0kubun
"expand tabs" is not intended to be applied to strftime.c, because its c-file-style is "linux", not "ruby". It's explicitly excluded to expand tabs https://git.ruby-lang.org/ruby-commit-hook.git/tree/svn-utils/bin/auto-style.rb#n195 but it didn't work. I fixed the issue in https://git.ruby-lang.org/ruby-commit-hook.git/commit/svn-utils/bin/auto-style.rb?id=844e0d42de11ad4c549bfbdd752a21df2823c18c so let me try to revert the strftime.c change to keep the tabs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-08* expand tabs.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-08Timezone support by Time [Feature #14850]nobu
* 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
2018-08-08Store String as zone in struct vtm.akr
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
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