IOS获取两个时间的毫秒差
by 伍雪颖
NSString *savedTime = [[NSUserDefaults standardUserDefaults] stringForKey:@"time"]; NSString *time = [NSString stringWithFormat:@"%f", (double)[[NSDate date] timeIntervalSince1970]]; NSLog(@"\n%@\n%@",time,savedTime); NSLog(@"%.f",([time doubleValue] - [savedTime doubleValue]) * 1000); [[NSUserDefaults standardUserDefaults] setObject:time forKey:@"time"]; [[NSUserDefaults standardUserDefaults] synchronize];
IOS获取两个时间的毫秒差
时间: 2024-10-12 21:54:23