Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6196563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:39:55+00:00 2026-05-24T03:39:55+00:00

I want to nslog the device motion timestamp property . The device motion is

  • 0

I want to nslog the device motion timestamp property .

The device motion is in the class CMMotionManager.devicemotion.timestamp

Any ideas.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:39:55+00:00Added an answer on May 24, 2026 at 3:39 am

    Edit: Please see Nicolas Lauquin’s answer. Per the comments, the following solution is not correct but is retained here for history (and because I can’t delete it since it is currently marked accepted).


    The timestamp property is an NSTimeInterval, so you should be able to do:

    NSLog(@"Motion at time: %@",
    [NSDate dateWithTimeIntervalSinceReferenceDate:devicemotion.timestamp]);
    

    NSTimeInterval is just a typedef’d double type, so you could use %f instead of %@ and log it directly.

    Also, the docs don’t indicate whether this timestamp is set against Apple’s reference date or the standard *nix date, so you may need to use [NSDate dateWithTimeIntervalSince1970:] if the aforementioned method returns dates far in the future.

    As @davidbitton has suggested the CMDeviceMotion‘s timestamp is relative to the last device boot, the correct NSDate could be derived by

    NSDate *startupTime = [NSDate dateWithTimeIntervalSinceNow:
                              -1 * [[NSProcessInfo processInfo] systemUptime]];
    
    NSDate *deviceMotionDate = [NSDate dateWithTimeInterval:devicemotion.timestamp 
                                                  sinceDate:startupTime];
    

    This should yield a roughly accurate NSDate object, assuming @davidbitton is correct. (reference: NSProcessInfo -systemUptime)

    However, given how complicated this is, I would now suggest for simplicity that, given the nature of the timestamp property, that you log it in a format string as something like

    "... event logged at %0.2f seconds since startup...", devicemotion.timestamp
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to define a following function: if(stmtToFinalize) { NSLog(@Finalizing statement stmtToFinalize); if (sqlite3_finalize(stmtToFinalize)
When I use NSLog(@fooBar) it prints out a lot of stuff I don't want:
I wanted to test my app on the device, but I dont want now
I want to know about the difference between the NSLog and the Printf statement
I want to detect whether passing a NSString to NSLog will return (null) .
I'm pretty new to IOS. I want to get all pictures on a device
Thanks in advance I want to detect when orientation changed in my device ...
On the shake of the iPhone device i want some function to be called,
I want to create a Terminal application that connects to a Bluetooth Device and
I have a custom class called Device which implements the MKAnnotation protocol. In the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.