Kaynağa Gözat

remove `strptime` and bumping the version to 0.9.6

ibireme 9 yıl önce
ebeveyn
işleme
2706e92598
3 değiştirilmiş dosya ile 2 ekleme ve 20 silme
  1. 1 1
      Framework/Info.plist
  2. 1 1
      YYModel.podspec
  3. 0 18
      YYModel/NSObject+YYModel.m

+ 1 - 1
Framework/Info.plist

@@ -15,7 +15,7 @@
 	<key>CFBundlePackageType</key>
 	<string>FMWK</string>
 	<key>CFBundleShortVersionString</key>
-	<string>0.9.5</string>
+	<string>0.9.6</string>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>

+ 1 - 1
YYModel.podspec

@@ -1,7 +1,7 @@
 Pod::Spec.new do |s|
   s.name         = 'YYModel'
   s.summary      = 'High performance model framework for iOS.'
-  s.version      = '0.9.5'
+  s.version      = '0.9.6'
   s.license      = { :type => 'MIT', :file => 'LICENSE' }
   s.authors      = { 'ibireme' => 'ibireme@gmail.com' }
   s.social_media_url = 'http://blog.ibireme.com'

+ 0 - 18
YYModel/NSObject+YYModel.m

@@ -169,15 +169,6 @@ static NSDate *YYNSDateFromString(__unsafe_unretained NSString *string) {
                 if ([string characterAtIndex:10] == 'T') {
                     return [formatter1 dateFromString:string];
                 } else {
-                    time_t t = 0;
-                    struct tm tm = {0};
-                    strptime([string cStringUsingEncoding:NSUTF8StringEncoding], "%Y-%m-%d %H:%M:%S", &tm);
-                    tm.tm_isdst = -1;
-                    t = mktime(&tm);
-                    if (t >= 0) {
-                        NSDate *date = [NSDate dateWithTimeIntervalSince1970:t + [[NSTimeZone localTimeZone] secondsFromGMT]];
-                        if (date) return date;
-                    }
                     return [formatter2 dateFromString:string];
                 }
             };
@@ -193,15 +184,6 @@ static NSDate *YYNSDateFromString(__unsafe_unretained NSString *string) {
             formatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
             formatter.dateFormat = @"yyyy-MM-dd'T'HH:mm:ssZ";
             blocks[20] = ^(NSString *string) {
-                time_t t = 0;
-                struct tm tm = {0};
-                strptime([string cStringUsingEncoding:NSUTF8StringEncoding], "%Y-%m-%dT%H:%M:%S%z", &tm);
-                tm.tm_isdst = -1;
-                t = mktime(&tm);
-                if (t >= 0) {
-                    NSDate *date = [NSDate dateWithTimeIntervalSince1970:t + [[NSTimeZone localTimeZone] secondsFromGMT]];
-                    if (date) return date;
-                }
                 return [formatter dateFromString:string];
             };
             blocks[24] = ^(NSString *string) { return [formatter dateFromString:string]; };