pub fn parse(&self, s: &str, fmt: &str) -> Result<Datetime, InputError> {
        let mut tm = libc::tm {
            tm_sec: 0,
            tm_min: 0,
            tm_hour: 0,
            tm_mday: 1,
            tm_mon: 0,
            tm_year: 0,
            tm_wday: 0,
            tm_yday: 0,
            tm_isdst: 0,
            // Unused
            tm_gmtoff: 0,
            tm_zone: sys::empty_tm_zone(),
        };

        // We have to handle ending \x00 byte.
        let s = try!(std::ffi::CString::new(s).map_err(|_| InputError::InvalidFormat));
        let fmt = try!(std::ffi::CString::new(fmt).map_err(|_| InputError::InvalidFormat));

        let ret = unsafe {
            strptime(s.as_ptr() as *const libc::c_char,
                     fmt.as_ptr() as *const libc::c_char,
                     &mut tm)
        };

        if ret == ptr::null() {
            Err(InputError::InvalidFormat)
        } else {
            self.datetime(tm.tm_year + 1900,
                          tm.tm_mon + 1,
                          tm.tm_mday,
                          tm.tm_hour,
                          tm.tm_min,
                          tm.tm_sec,
                          0)
        }
    }
/// Parse a `Datetime` relative to this `Timezone` according to the
/// given format. Timezone-related field are ignored. An `InputError`
/// is returned if the string does not match the format.
Parse a `Datetime` relative to this `Timezone` according to the
given format. Timezone-related field are ignored. An `InputError`
is returned if the string does not match the format.
Parse a ` Datetime ` relative to this ` Timezone ` according to the given format . Timezone - related field are ignored . An ` InputError ` is returned if the string does not match the format .
pub fn parse(&self, s: &str, fmt: &str) -> Result<Datetime, InputError> {
        let mut tm = libc::tm {
            tm_sec: 0,
            tm_min: 0,
            tm_hour: 0,
            tm_mday: 1,
            tm_mon: 0,
            tm_year: 0,
            tm_wday: 0,
            tm_yday: 0,
            tm_isdst: 0,
            // Unused
            tm_gmtoff: 0,
            tm_zone: sys::empty_tm_zone(),
        };
        // We have to handle ending \x00 byte.
        let s = try!(std::ffi::CString::new(s).map_err(|_| InputError::InvalidFormat));
        let fmt = try!(std::ffi::CString::new(fmt).map_err(|_| InputError::InvalidFormat));
        let ret = unsafe {
            strptime(s.as_ptr() as *const libc::c_char,
                     fmt.as_ptr() as *const libc::c_char,
                     &mut tm)
        };
        if ret == ptr::null() {
            Err(InputError::InvalidFormat)
        } else {
            self.datetime(tm.tm_year + 1900,
                          tm.tm_mon + 1,
                          tm.tm_mday,
                          tm.tm_hour,
                          tm.tm_min,
                          tm.tm_sec,
                          0)
        }
    }
pub fn parse ( & self , s : & str , fmt : & str ) -> Result < Datetime , InputError > { let mut tm = libc :: tm { tm_sec : 0 , tm_min : 0 , tm_hour : 0 , tm_mday : 1 , tm_mon : 0 , tm_year : 0 , tm_wday : 0 , tm_yday : 0 , tm_isdst : 0 , // Unused tm_gmtoff : 0 , tm_zone : sys :: empty_tm_zone ( ) , } ; // We have to handle ending \x00 byte. let s = try ! ( std ffi CString new ( s ) map_err ( InputError InvalidFormat ) ) ; let fmt = try ! ( std ffi CString new ( fmt ) map_err ( InputError InvalidFormat ) ) ; let ret = unsafe { strptime ( s . as_ptr ( ) as * const libc :: c_char , fmt . as_ptr ( ) as * const libc :: c_char , & mut tm ) } ; if ret == ptr :: null ( ) { Err ( InputError :: InvalidFormat ) } else { self . datetime ( tm . tm_year + 1900 , tm . tm_mon + 1 , tm . tm_mday , tm . tm_hour , tm . tm_min , tm . tm_sec , 0 ) } }
Parse a `Datetime` relative to this `Timezone` according to the
given format.
Parse a ` Datetime ` relative to this ` Timezone ` according to the given format .
&self
s
&str
fmt
&str