Method: Strptime#execi
- Defined in:
- ext/strptime/strptime.c
#execi(str) ⇒ Integer
Parse given string, and return epoch as integer
692 693 694 695 696 697 698 699 700 701 702 703 704 705 |
# File 'ext/strptime/strptime.c', line 692
static VALUE
strptime_execi(VALUE self, VALUE str)
{
struct strptime_object *tobj;
struct timespec ts;
int r, gmtoff = INT_MAX;
StringValue(str);
GetStrptimeval(self, tobj);
r = strptime_exec0(tobj->isns, RSTRING_PTR(tobj->fmt), RSTRING_PTR(str),
RSTRING_LEN(str), &ts, &gmtoff);
if (r) rb_raise(rb_eArgError, "string doesn't match");
return TIMET2NUM(ts.tv_sec);
}
|