Commit 0b5b676f41ad1f2abd28ee925475cf1307832b97

Authored by yinqiaojuan
1 parent 536ba71f

0.0.2

CNLiveBaseTools.podspec
1 1
2 Pod::Spec.new do |s| 2 Pod::Spec.new do |s|
3 s.name = 'CNLiveBaseTools' 3 s.name = 'CNLiveBaseTools'
4 - s.version = '0.0.1' 4 + s.version = '0.0.2'
5 s.summary = '基础工具库时间声音等工具' 5 s.summary = '基础工具库时间声音等工具'
6 6
7 s.description = <<-DESC 7 s.description = <<-DESC
CNLiveBaseTools/Classes/CNLiveTimeTools.h
@@ -11,8 +11,6 @@ @@ -11,8 +11,6 @@
11 NS_ASSUME_NONNULL_BEGIN 11 NS_ASSUME_NONNULL_BEGIN
12 12
13 @interface CNLiveTimeTools : NSObject 13 @interface CNLiveTimeTools : NSObject
14 -  
15 -+ (instancetype)manager;  
16 //项目中没有用到 14 //项目中没有用到
17 + (NSString *)getTimestamp:(NSDate *)date; 15 + (NSString *)getTimestamp:(NSDate *)date;
18 // 当前的10位时间戳 16 // 当前的10位时间戳
@@ -40,6 +38,10 @@ NS_ASSUME_NONNULL_BEGIN @@ -40,6 +38,10 @@ NS_ASSUME_NONNULL_BEGIN
40 + (NSString *)getDateByTimeStamp:(NSString *)timeStampString; 38 + (NSString *)getDateByTimeStamp:(NSString *)timeStampString;
41 //获得系统当前时间 39 //获得系统当前时间
42 + (NSString *_Nullable)getyyMMddStr; 40 + (NSString *_Nullable)getyyMMddStr;
  41 +//一个时间戳与当前时间的间隔(s)
  42 ++ (NSInteger)getIntervalsWithTimeStamp:(NSTimeInterval)timeStamp;
  43 +//时间转换为时间戳,精确到微秒
  44 ++ (NSTimeInterval)getTimeStampWithDate:(NSDate *)date;
43 45
44 @end 46 @end
45 47
CNLiveBaseTools/Classes/CNLiveTimeTools.m
@@ -10,15 +10,6 @@ @@ -10,15 +10,6 @@
10 10
11 @implementation CNLiveTimeTools 11 @implementation CNLiveTimeTools
12 12
13 -+ (instancetype)manager {  
14 - static CNLiveTimeTools *manager;  
15 - static dispatch_once_t onceToken;  
16 - dispatch_once(&onceToken, ^{  
17 - manager = [[self alloc] init];  
18 - });  
19 - return manager;  
20 -}  
21 -  
22 + (NSString *)getTimestamp:(NSDate *)date{ 13 + (NSString *)getTimestamp:(NSDate *)date{
23 NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; 14 NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
24 [formatter setDateStyle:NSDateFormatterMediumStyle]; 15 [formatter setDateStyle:NSDateFormatterMediumStyle];
@@ -215,4 +206,19 @@ @@ -215,4 +206,19 @@
215 NSString *currentDateStr = [dateFormatter stringFromDate:[NSDate date]]; 206 NSString *currentDateStr = [dateFormatter stringFromDate:[NSDate date]];
216 return currentDateStr; 207 return currentDateStr;
217 } 208 }
  209 +#pragma mark -一个时间戳与当前时间的间隔(s)
  210 ++ (NSInteger)getIntervalsWithTimeStamp:(NSTimeInterval)timeStamp {
  211 + return [[NSDate date]timeIntervalSinceDate:[self getDateWithTimeStamp:timeStamp]];
  212 +}
  213 +// 时间戳转换为时间
  214 ++ (NSDate *)getDateWithTimeStamp:(NSTimeInterval)timeStamp
  215 +{
  216 + return [NSDate dateWithTimeIntervalSince1970:timeStamp * 0.001 * 0.001];
  217 +}
  218 +// 时间转换为时间戳,精确到微秒
  219 ++ (NSTimeInterval)getTimeStampWithDate:(NSDate *)date
  220 +{
  221 + return [[NSNumber numberWithDouble:[date timeIntervalSince1970] * 1000 * 1000] longLongValue];
  222 +}
  223 +
218 @end 224 @end
Example/Pods/Pods.xcodeproj/project.pbxproj
@@ -45,14 +45,14 @@ @@ -45,14 +45,14 @@
45 08C0397C0487BE199D8C882BDDA24415 /* Pods-CNLiveBaseTools_Tests-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CNLiveBaseTools_Tests-resources.sh"; sourceTree = "<group>"; }; 45 08C0397C0487BE199D8C882BDDA24415 /* Pods-CNLiveBaseTools_Tests-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CNLiveBaseTools_Tests-resources.sh"; sourceTree = "<group>"; };
46 0BF67CC1199147B52C8A42AA38C946D2 /* CNLiveBaseTools.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = CNLiveBaseTools.modulemap; sourceTree = "<group>"; }; 46 0BF67CC1199147B52C8A42AA38C946D2 /* CNLiveBaseTools.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = CNLiveBaseTools.modulemap; sourceTree = "<group>"; };
47 0CA6B6B13373CC3AD218F548F456401E /* Pods-CNLiveBaseTools_Tests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-CNLiveBaseTools_Tests-acknowledgements.markdown"; sourceTree = "<group>"; }; 47 0CA6B6B13373CC3AD218F548F456401E /* Pods-CNLiveBaseTools_Tests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-CNLiveBaseTools_Tests-acknowledgements.markdown"; sourceTree = "<group>"; };
48 - 0EBDC3857DEC799FBF96088C4D4913CE /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; path = README.md; sourceTree = "<group>"; }; 48 + 0EBDC3857DEC799FBF96088C4D4913CE /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
49 0F6F5625CCE639F611C56C8A63AFE352 /* Pods-CNLiveBaseTools_Example-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CNLiveBaseTools_Example-resources.sh"; sourceTree = "<group>"; }; 49 0F6F5625CCE639F611C56C8A63AFE352 /* Pods-CNLiveBaseTools_Example-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CNLiveBaseTools_Example-resources.sh"; sourceTree = "<group>"; };
50 126948091064245E2482AADBF6552ABB /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 50 126948091064245E2482AADBF6552ABB /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
51 19223E757CE06BBA9FA95EFED2880FEF /* Pods-CNLiveBaseTools_Tests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-CNLiveBaseTools_Tests-dummy.m"; sourceTree = "<group>"; }; 51 19223E757CE06BBA9FA95EFED2880FEF /* Pods-CNLiveBaseTools_Tests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-CNLiveBaseTools_Tests-dummy.m"; sourceTree = "<group>"; };
52 20192C745988ACC952A43560564B4741 /* Pods-CNLiveBaseTools_Tests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-CNLiveBaseTools_Tests-umbrella.h"; sourceTree = "<group>"; }; 52 20192C745988ACC952A43560564B4741 /* Pods-CNLiveBaseTools_Tests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-CNLiveBaseTools_Tests-umbrella.h"; sourceTree = "<group>"; };
53 - 29D49B36EB5F7DCBC9A72324A0CCDF83 /* CNLiveBaseTools.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; lastKnownFileType = text; path = CNLiveBaseTools.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 53 + 29D49B36EB5F7DCBC9A72324A0CCDF83 /* CNLiveBaseTools.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; path = CNLiveBaseTools.podspec; sourceTree = "<group>"; };
54 2EFB40531CB700ADF867FEEE78561E78 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 54 2EFB40531CB700ADF867FEEE78561E78 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
55 - 30E5E40772A923ACAC17925B1ECBF40D /* Pods_CNLiveBaseTools_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_CNLiveBaseTools_Example.framework; path = "Pods-CNLiveBaseTools_Example.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; 55 + 30E5E40772A923ACAC17925B1ECBF40D /* Pods_CNLiveBaseTools_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CNLiveBaseTools_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
56 442A16CF826C11E232C0F28B1007A6D7 /* CNLiveVoiceTools.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = CNLiveVoiceTools.m; path = CNLiveBaseTools/Classes/CNLiveVoiceTools.m; sourceTree = "<group>"; }; 56 442A16CF826C11E232C0F28B1007A6D7 /* CNLiveVoiceTools.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = CNLiveVoiceTools.m; path = CNLiveBaseTools/Classes/CNLiveVoiceTools.m; sourceTree = "<group>"; };
57 468AD360F2603144033041EEF5C68898 /* Pods-CNLiveBaseTools_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CNLiveBaseTools_Tests.release.xcconfig"; sourceTree = "<group>"; }; 57 468AD360F2603144033041EEF5C68898 /* Pods-CNLiveBaseTools_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CNLiveBaseTools_Tests.release.xcconfig"; sourceTree = "<group>"; };
58 4AE213A630A6E1AE7D7485C659419433 /* Pods-CNLiveBaseTools_Example-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CNLiveBaseTools_Example-frameworks.sh"; sourceTree = "<group>"; }; 58 4AE213A630A6E1AE7D7485C659419433 /* Pods-CNLiveBaseTools_Example-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CNLiveBaseTools_Example-frameworks.sh"; sourceTree = "<group>"; };
@@ -65,14 +65,14 @@ @@ -65,14 +65,14 @@
65 8EE3CCB004C78CC47C455C2D3D833FA2 /* Pods-CNLiveBaseTools_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CNLiveBaseTools_Example.debug.xcconfig"; sourceTree = "<group>"; }; 65 8EE3CCB004C78CC47C455C2D3D833FA2 /* Pods-CNLiveBaseTools_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CNLiveBaseTools_Example.debug.xcconfig"; sourceTree = "<group>"; };
66 8F59FFC1D8AFE64A7C283FC49AC11217 /* Pods-CNLiveBaseTools_Example-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-CNLiveBaseTools_Example-acknowledgements.plist"; sourceTree = "<group>"; }; 66 8F59FFC1D8AFE64A7C283FC49AC11217 /* Pods-CNLiveBaseTools_Example-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-CNLiveBaseTools_Example-acknowledgements.plist"; sourceTree = "<group>"; };
67 91ACAB33F8ADDC43E7CF47EB6B8AB223 /* Pods-CNLiveBaseTools_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CNLiveBaseTools_Tests.debug.xcconfig"; sourceTree = "<group>"; }; 67 91ACAB33F8ADDC43E7CF47EB6B8AB223 /* Pods-CNLiveBaseTools_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CNLiveBaseTools_Tests.debug.xcconfig"; sourceTree = "<group>"; };
68 - 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 68 + 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
69 A1C2B131A95849590ECCF4B659F1F494 /* CNLiveBaseTools-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "CNLiveBaseTools-dummy.m"; sourceTree = "<group>"; }; 69 A1C2B131A95849590ECCF4B659F1F494 /* CNLiveBaseTools-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "CNLiveBaseTools-dummy.m"; sourceTree = "<group>"; };
70 - A2ED64F7670B049C744837CC6D258927 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; path = LICENSE; sourceTree = "<group>"; }; 70 + A2ED64F7670B049C744837CC6D258927 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
71 C852AB68DEBF20B780284851E5C50142 /* CNLiveTimeTools.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = CNLiveTimeTools.m; path = CNLiveBaseTools/Classes/CNLiveTimeTools.m; sourceTree = "<group>"; }; 71 C852AB68DEBF20B780284851E5C50142 /* CNLiveTimeTools.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = CNLiveTimeTools.m; path = CNLiveBaseTools/Classes/CNLiveTimeTools.m; sourceTree = "<group>"; };
72 D02C7DB6D7C40E0A76B994BB4751CF6D /* Pods-CNLiveBaseTools_Example-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-CNLiveBaseTools_Example-umbrella.h"; sourceTree = "<group>"; }; 72 D02C7DB6D7C40E0A76B994BB4751CF6D /* Pods-CNLiveBaseTools_Example-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-CNLiveBaseTools_Example-umbrella.h"; sourceTree = "<group>"; };
73 - D7C1165C887848EB3684E324C38BF109 /* Pods_CNLiveBaseTools_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_CNLiveBaseTools_Tests.framework; path = "Pods-CNLiveBaseTools_Tests.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; 73 + D7C1165C887848EB3684E324C38BF109 /* Pods_CNLiveBaseTools_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CNLiveBaseTools_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
74 D864D4FEB7AE26B10D19DC14378FA15F /* Pods-CNLiveBaseTools_Tests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CNLiveBaseTools_Tests-frameworks.sh"; sourceTree = "<group>"; }; 74 D864D4FEB7AE26B10D19DC14378FA15F /* Pods-CNLiveBaseTools_Tests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CNLiveBaseTools_Tests-frameworks.sh"; sourceTree = "<group>"; };
75 - DAD2205FCB4AD2B7485B2C8B0E1AC7C1 /* CNLiveBaseTools.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = CNLiveBaseTools.framework; path = CNLiveBaseTools.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 75 + DAD2205FCB4AD2B7485B2C8B0E1AC7C1 /* CNLiveBaseTools.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CNLiveBaseTools.framework; sourceTree = BUILT_PRODUCTS_DIR; };
76 DC11C82F3498690320CC619481A8E811 /* Pods-CNLiveBaseTools_Example-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-CNLiveBaseTools_Example-dummy.m"; sourceTree = "<group>"; }; 76 DC11C82F3498690320CC619481A8E811 /* Pods-CNLiveBaseTools_Example-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-CNLiveBaseTools_Example-dummy.m"; sourceTree = "<group>"; };
77 DC825D7A055CEC63C5AF56833B5FD34A /* CNLiveBaseTools.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = CNLiveBaseTools.xcconfig; sourceTree = "<group>"; }; 77 DC825D7A055CEC63C5AF56833B5FD34A /* CNLiveBaseTools.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = CNLiveBaseTools.xcconfig; sourceTree = "<group>"; };
78 E571A7124D23F01709B447D2EDCED277 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 78 E571A7124D23F01709B447D2EDCED277 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -544,8 +544,7 @@ @@ -544,8 +544,7 @@
544 MTL_FAST_MATH = YES; 544 MTL_FAST_MATH = YES;
545 PRODUCT_NAME = "$(TARGET_NAME)"; 545 PRODUCT_NAME = "$(TARGET_NAME)";
546 STRIP_INSTALLED_PRODUCT = NO; 546 STRIP_INSTALLED_PRODUCT = NO;
547 - SWIFT_COMPILATION_MODE = wholemodule;  
548 - SWIFT_OPTIMIZATION_LEVEL = "-O"; 547 + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
549 SWIFT_VERSION = 4.2; 548 SWIFT_VERSION = 4.2;
550 SYMROOT = "${SRCROOT}/../build"; 549 SYMROOT = "${SRCROOT}/../build";
551 }; 550 };