Simplify default values of Time.at
[Bug #18293]
This commit is contained in:
parent
cc33d07f46
commit
83bdc2f00c
6
time.c
6
time.c
@ -2678,13 +2678,13 @@ get_scale(VALUE unit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
time_s_at(rb_execution_context_t *ec, VALUE klass, VALUE time, VALUE subsec, VALUE unit, VALUE zone, VALUE nosubsec, VALUE nounit)
|
time_s_at(rb_execution_context_t *ec, VALUE klass, VALUE time, VALUE subsec, VALUE unit, VALUE zone)
|
||||||
{
|
{
|
||||||
VALUE t;
|
VALUE t;
|
||||||
wideval_t timew;
|
wideval_t timew;
|
||||||
|
|
||||||
if (!RTEST(nosubsec)) {
|
if (!NIL_P(subsec)) {
|
||||||
int scale = !RTEST(nounit) ? get_scale(unit) : 1000000;
|
int scale = get_scale(unit);
|
||||||
time = num_exact(time);
|
time = num_exact(time);
|
||||||
t = num_exact(subsec);
|
t = num_exact(subsec);
|
||||||
timew = wadd(rb_time_magnify(v2w(time)), wmulquoll(v2w(t), TIME_SCALE, scale));
|
timew = wadd(rb_time_magnify(v2w(time)), wmulquoll(v2w(t), TIME_SCALE, scale));
|
||||||
|
4
timev.rb
4
timev.rb
@ -267,8 +267,8 @@ class Time
|
|||||||
# :include: doc/time/nsec.rdoc
|
# :include: doc/time/nsec.rdoc
|
||||||
# :include: doc/time/in.rdoc
|
# :include: doc/time/in.rdoc
|
||||||
#
|
#
|
||||||
def self.at(time, subsec = (nosubsec = true), unit = (nounit = true), in: nil)
|
def self.at(time, subsec = nil, unit = :microsecond, in: nil)
|
||||||
__builtin.time_s_at(time, subsec, unit, __builtin.arg!(:in), nosubsec, nounit)
|
__builtin.time_s_at(time, subsec, unit, __builtin.arg!(:in))
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns a new \Time object based the on given arguments.
|
# Returns a new \Time object based the on given arguments.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user