There are several ways of doing this, although my personal favorite is:
CFAbsoluteTime timeInSeconds = CFAbsoluteTimeGetCurrent();
You can read more about this method here. You can also create a NSDate object and get time by calling timeIntervalSince1970 which returns the seconds since 1/1/1970:
NSTimeInterval timeInSeconds = [[NSDate date] timeIntervalSince1970];
And in Swift:
let timeInSeconds: TimeInterval = Date().timeIntervalSince1970
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…