代码如下:
NSDateFormatter *formatter;
formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyyMMdd"];
for (int i=0; i<10000; i++) {
dispatch_queue_t aQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(aQueue, ^{
NSString *dateKey = [formatter stringFromDate:[NSDate date]];
NSLog(dateKey);
});
}
datekey 有时是 47130101 吗?正常值是 20120608。但我有时会得到 47130101。