@@ -2686,7 +2686,7 @@ get_scale(VALUE unit)
2686
2686
* can be an Integer, Float, Rational, or other Numeric.
2687
2687
* non-portable feature allows the offset to be negative on some systems.
2688
2688
*
2689
- * If +tz + argument is given, the result is in that timezone or UTC offset, or
2689
+ * If +in + argument is given, the result is in that timezone or UTC offset, or
2690
2690
* if a numeric argument is given, the result is in local time.
2691
2691
*
2692
2692
* Time.at(0) #=> 1969-12-31 18:00:00 -0600
@@ -2701,13 +2701,19 @@ get_scale(VALUE unit)
2701
2701
static VALUE
2702
2702
time_s_at (int argc , VALUE * argv , VALUE klass )
2703
2703
{
2704
- VALUE time , t , unit = Qundef , zone = Qnil ;
2704
+ VALUE time , t , unit = Qundef , zone = Qundef , opts ;
2705
2705
wideval_t timew ;
2706
2706
2707
- if (argc > 1 && rb_obj_respond_to (argv [argc - 1 ], id_utc_to_local , Qfalse )) {
2708
- zone = argv [-- argc ];
2707
+ argc = rb_scan_args (argc , argv , "12:" , & time , & t , & unit , & opts );
2708
+ if (!NIL_P (opts )) {
2709
+ ID ids [1 ];
2710
+ VALUE vals [numberof (ids )];
2711
+
2712
+ CONST_ID (ids [0 ], "in" );
2713
+ rb_get_kwargs (opts , ids , 0 , 1 , vals );
2714
+ zone = vals [0 ];
2709
2715
}
2710
- if (rb_scan_args ( argc , argv , "12" , & time , & t , & unit ) >= 2 ) {
2716
+ if (argc >= 2 ) {
2711
2717
int scale = argc == 3 ? get_scale (unit ) : 1000000 ;
2712
2718
time = num_exact (time );
2713
2
6C09
719
t = num_exact (t );
@@ -2725,7 +2731,7 @@ time_s_at(int argc, VALUE *argv, VALUE klass)
2725
2731
timew = rb_time_magnify (v2w (num_exact (time )));
2726
2732
t = time_new_timew (klass , timew );
2727
2733
}
2728
- if (! NIL_P ( zone ) ) {
2734
+ if (zone != Qundef ) {
2729
2735
time_zonelocal (t , zone );
2730
2736
}
2731
2737
0 commit comments