ext/iodine/iodine_helpers.c
/**
Takes `time` and returns a faster (though less localized) HTTP Date formatted
String.


        Iodine::Rack.rfc2822(Time.now) => "Sun, 11 Jun 2017 06:14:08 -0000"

        Iodine::Rack.rfc2822(0)      => "Sun, 11 Jun 2017 06:14:08 -0000"

Since Iodine uses time caching within it's reactor, using the default value
(by passing 0) will be faster than providing an explicit time using `Time.now`.
*/
Takes `time` and returns a faster (though less localized) HTTP Date formatted
String.





Since Iodine uses time caching within it's reactor, using the default value
(by passing 0) will be faster than providing an explicit time using `Time.now`.
Takes ` time ` and returns a faster ( though less localized ) HTTP Date formatted String . Since Iodine uses time caching within it ' s reactor using the default value ( by passing 0 ) will be faster than providing an explicit time using ` Time . now ` .
static VALUE iodine_rfc2822(VALUE self, VALUE rtm) {
  time_t last_tick;
  rtm = rb_funcallv(rtm, iodine_to_i_func_id, 0, NULL);
  last_tick = FIX2ULONG(rtm) ? FIX2ULONG(rtm) : fio_last_tick().tv_sec;
  VALUE str = rb_str_buf_new(34);
  struct tm tm;
  http_gmtime(last_tick, &tm);
  size_t len = http_date2rfc2822(RSTRING_PTR(str), &tm);
  rb_str_set_len(str, len);
  return str;
  (void)self;
}
static VALUE iodine_rfc2822 ( VALUE self , VALUE rtm ) { time_t last_tick ; rtm = rb_funcallv ( rtm , iodine_to_i_func_id , 0 , NULL ) ; last_tick = FIX2ULONG ( rtm ) ? FIX2ULONG ( rtm ) : fio_last_tick ( ) . tv_sec ; VALUE str = rb_str_buf_new ( 34 ) ; struct tm tm ; http_gmtime ( last_tick , & tm ) ; size_t len = http_date2rfc2822 ( RSTRING_PTR ( str ) , & tm ) ; rb_str_set_len ( str , len ) ; return str ; ( void ) self ; }
Takes `time` and returns a faster (though less localized) HTTP Date formatted
String.
Takes ` time ` and returns a faster ( though less localized ) HTTP Date formatted String .