@@ -62,10 +62,6 @@ static VALUE sym_hour, sym_min, sym_sec, sym_subsec, sym_dst, sym_zone;
62
62
#define id_name idName
63
63
#define UTC_ZONE Qundef
64
64
65
- #ifndef TM_IS_TIME
66
- #define TM_IS_TIME 1
67
- #endif
68
-
69
65
#define NDIV (x ,y ) (-(-((x)+1)/(y))-1)
70
66
#define NMOD (x ,y ) ((y)-(-((x)+1)%(y))-1)
71
67
#define DIV (n ,d ) ((n)<0 ? NDIV((n),(d)) : (n)/(d))
@@ -5546,7 +5542,6 @@ tm_from_time(VALUE klass, VALUE time)
5546
5542
{
5547
5543
struct time_object * tobj ;
5548
5544
struct vtm vtm , * v ;
5549
- #if TM_IS_TIME
5550
5545
VALUE tm ;
5551
5546
struct time_object * ttm ;
5552
5547
@@ -5562,29 +5557,6 @@ tm_from_time(VALUE klass, VALUE time)
5562
5557
ttm -> tm_got = 1 ;
5563
5558
TZMODE_SET_UTC (ttm );
5564
5559
return tm ;
5565
- #else
5566
- VALUE args [8 ];
5567
- int i = 0 ;
5568
-
5569
- GetTimeval (time , tobj );
5570
- if (tobj -> tm_got && TZMODE_UTC_P (tobj ))
5571
- v = & tobj -> vtm ;
5572
- else
5573
- GMTIMEW (tobj -> timew , v = & vtm );
5574
- args [i ++ ] = v -> year ;
5575
- args [i ++ ] = INT2FIX (v -> mon );
5576
- args [i ++ ] = INT2FIX (v -> mday );
5577
- args [i ++ ] = INT2FIX (v -> hour );
5578
- args [i ++ ] = INT2FIX (v -> min );
5579
- args [i ++ ] = INT2FIX (v -> sec );
5580
- switch (v -> isdst ) {
5581
- case 0 : args [i ++ ] = Qfalse ; break ;
5582
- case 1 : args [i ++ ] = Qtrue ; break ;
5583
- default : args [i ++ ] = Qnil ; break ;
5584
- }
5585
- args [i ++ ] = w2v (rb_time_unmagnify (tobj -> timew ));
5586
- return rb_class_new_instance (i , args , klass );
5587
- #endif
5588
5560
}
5589
5561
5590
5562
/*
@@ -5604,23 +5576,10 @@ tm_initialize(int argc, VALUE *argv, VALUE tm)
5604
5576
if (rb_check_arity (argc , 1 , 7 ) > 6 ) argc = 6 ;
5605
5577
time_arg (argc , argv , & vtm );
5606
5578
t = timegmw (& vtm );
5607
- {
5608
- #if TM_IS_TIME
5609
- struct time_object * tobj = DATA_PTR (tm );
5610
- TZMODE_SET_UTC (tobj );
5611
- tobj -> timew = t ;
5612
- tobj -> vtm = vtm ;
5613
- #else
5614
- int i = 0 ;
5615
- RSTRUCT_SET (tm , i ++ , INT2FIX (vtm .sec ));
5616
- RSTRUCT_SET (tm , i ++ , INT2FIX (vtm .min ));
5617
- RSTRUCT_SET (tm , i ++ , INT2FIX (vtm .hour ));
5618
- RSTRUCT_SET (tm , i ++ , INT2FIX (vtm .mday ));
5619
- RSTRUCT_SET (tm , i ++ , INT2FIX (vtm .mon ));
5620
- RSTRUCT_SET (tm , i ++ , vtm .year );
5621
- RSTRUCT_SET (tm , i ++ , w2v (rb_time_unmagnify (t )));
5622
- #endif
5623
- }
5579
+ struct time_object * tobj = DATA_PTR (tm );
5580
+ TZMODE_SET_UTC (tobj );
5581
+ tobj -> timew = t ;
5582
+ tobj -> vtm = vtm ;
5624
5583
return tm ;
5625
5584
}
5626
5585
@@ -5634,51 +5593,13 @@ tm_initialize(int argc, VALUE *argv, VALUE tm)
5634
5593
static VALUE
5635
5594
tm_to_time (VALUE tm )
5636
5595
{
5637
- #if TM_IS_TIME
5638
5596
struct time_object * torig = get_timeval (tm );
5639
5597
VALUE dup = time_s_alloc (rb_cTime );
5640
5598
struct time_object * tobj = DATA_PTR (dup );
5641
5599
* tobj = * torig ;
5642
5600
return dup ;
5643
- #else
5644
- VALUE t [6 ];
5645
- const VALUE * p = RSTRUCT_CONST_PTR (tm );
5646
- int i ;
5647
-
5648
- for (i = 0 ; i < numberof (t ); ++ i ) {
5649
- t [i ] = p [numberof (t ) - 1 - i ];
5650
- }
5651
- return time_s_mkutc (numberof (t ), t , rb_cTime );
5652
- #endif
5653
5601
}
5654
5602
5655
- #if !TM_IS_TIME
5656
- static VALUE
5657
- tm_zero (VALUE tm )
5658
- {
5659
- return INT2FIX (0 );
5660
- }
5661
-
5662
- #define tm_subsec tm_zero
5663
- #define tm_utc_offset tm_zero
5664
-
5665
- static VALUE
5666
- tm_isdst (VALUE tm )
5667
- {
5668
- return Qfalse ;
5669
- }
5670
-
5671
- static VALUE
5672
- tm_to_s (VALUE tm )
5673
- {
5674
- const VALUE * p = RSTRUCT_CONST_PTR (tm );
5675
-
5676
- return rb_sprintf ("%.4" PRIsVALUE "-%.2" PRIsVALUE "-%.2" PRIsVALUE " "
5677
- "%.2" PRIsVALUE ":%.2" PRIsVALUE ":%.2" PRIsVALUE " "
5678
- "UTC" ,
5679
- p [5 ], p [4 ], p [3 ], p [2 ], p [1 ], p [0 ]);
5680
- }
5681
- #else
5682
5603
static VALUE
5683
5604
tm_plus (VALUE tm , VALUE offset )
5684
5605
{
@@ -5690,14 +5611,12 @@ tm_minus(VALUE tm, VALUE offset)
5690
5611
{
5691
5612
return time_add0 (rb_obj_class (tm ), get_timeval (tm ), tm , offset , -1 );
5692
5613
}
5693
- #endif
5694
5614
5695
5615
static VALUE
5696
5616
Init_tm (VALUE outer , const char * name )
5697
5617
{
5698
5618
/* :stopdoc:*/
5699
5619
VALUE tm ;
5700
- #if TM_IS_TIME
5701
5620
tm = rb_define_class_under (outer , name , rb_cObject );
5702
5621
rb_define_alloc_func (tm , time_s_alloc );
5703
5622
rb_define_method (tm , "sec" , time_sec , 0 );
@@ -5730,18 +5649,6 @@ Init_tm(VALUE outer, const char *name)
5730
5649
rb_define_method (tm , "to_r" , time_to_r , 0 );
5731
5650
rb_define_method (tm , "+" , tm_plus , 1 );
5732
5651
rb_define_method (tm , "-" , tm_minus , 1 );
5733
- #else
5734
- tm = rb_struct_define_under (outer , "tm" ,
5735
- "sec" , "min" , "hour" ,
5736
- "mday" , "mon" , "year" ,
5737
- "to_i" , NULL );
5738
- rb_define_method (tm , "subsec" , tm_subsec , 0 );
5739
- rb_define_method (tm , "utc_offset" , tm_utc_offset , 0 );
5740
- rb_define_method (tm , "to_s" , tm_to_s , 0 );
5741
- rb_define_method (tm , "inspect" , tm_to_s , 0 );
5742
- rb_define_method (tm , "isdst" , tm_isdst , 0 );
5743
- rb_define_method (tm , "dst?" , tm_isdst , 0 );
5744
- #endif
5745
5652
rb_define_method (tm , "initialize" , tm_initialize , -1 );
5746
5653
rb_define_method (tm , "utc" , tm_to_time , 0 );
5747
5654
rb_alias (tm , rb_intern_const ("to_time" ), rb_intern_const ("utc" ));
@@ -5913,11 +5820,6 @@ Init_Time(void)
5913
5820
/* methods for marshaling */
5914
5821
rb_define_private_method (rb_cTime , "_dump" , time_dump , -1 );
5915
5822
rb_define_private_method (scTime , "_load" , time_load , 1 );
5916
- #if 0
5917
- /* Time will support marshal_dump and marshal_load in the future (1.9 maybe) */
5918
- rb_define_private_method (rb_cTime , "marshal_dump" , time_mdump , 0 );
5919
- rb_define_private_method (rb_cTime , "marshal_load" , time_mload , 1 );
5920
- #endif
5921
5823
5922
5824
if (debug_find_time_numguess ) {
5923
5825
rb_define_hooked_variable ("$find_time_numguess" , (VALUE * )& find_time_numguess ,
0 commit comments