Home > Software design >  Print CMTime in objective C
Print CMTime in objective C

Time:04-22

I have some experience of swift, but zero knowledge on objective C I need to print a timestamp in the console, here it is:

  CMTime timeStamp = CMTimeMake(frame.timeStampNs / rtc::kNumNanosecsPerMillisec, 1000);

I added something like that:

NSLog(@timeStamp);

But it's failed, I need to print something like that in swift:

print("Timestamp: \(timeStamp)"

Could you please tell me how to do it on objective c?

Thanks

CodePudding user response:

Use the format specifier %f for 64-bit floating-point numbers (double)

NSLog("Timestamp: %f", CMTimeGetSeconds(timeStamp));

https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html

  • Related