Question

I just started saving sceenshots of my current application. Instead of giving the screenshots names beforehand I'd like to use the current date+ time (something unique) as the filename. I found a method timeIntervalSince1970 in objective C but it doesn't seem to exist in C4. So is there some other function that would return the current date?

Was it helpful?

Solution

timeIntervalSince1970 is a class method of NSDate. If you want to get the current time every screenshot you can use as a unique identifier you can do something like this.

NSString * s = [NSString stringWithFormat:@"awesomeshot%@.jpg", [NSDate date]];
C4Log(@"%@",s );

If you really want to use timeIntervalSince1970 you can check out this discussion: How to convert NSDate into unix timestamp iphone sdk?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top