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 6581655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:10:52+00:00 2026-05-25T16:10:52+00:00

I like to know how much time in second has elapsed since the user

  • 0

I like to know how much time in second has elapsed since the user logged on. (TickCount is not good because that is from system start)

I know I can use last or who to get the timestamp but what I am looking for a simple but robust solution.
I would use it in Cocoa but a unix command is fine.

  • 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-25T16:10:53+00:00Added an answer on May 25, 2026 at 4:10 pm

    At the end I used getlastlogx(), thanks for Rob Napier for pointing me to the right direction (+1).

    this is I came up with:

        struct lastlogx *lastLogin;
        uid_t myuid = getuid();
        lastLogin = getlastlogx(myuid,nil);
        NSDate *dateAtLogon = [NSDate dateWithTimeIntervalSince1970:lastLogin->ll_tv.tv_sec];
        NSDate *currentDate = [NSDate date];
        NSTimeInterval timeSinceLogin = [currentDate timeIntervalSinceDate:dateAtLogon];
        NSLog(@"%1.1f seconds since logon",timeSinceLogin); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know how much time (in percent) does JavaScript development takes
I know my question reads a bit like that 'how much wood can a
Like you know, .NET Remoting has some limits, one of them is that server
I'm a C# developer for Windows and I know NOT THAT MUCH about web
I would like to know how much disk space a directory is going to
i don't know much about IIS, except it's a web server (just like apache)
I like Gtalk's GUI very much. It's clear, simple, and pretty. I don't know
I want to know how to simply publish over http = much like Mercurial
I know the Confluence wiki pretty well, and I like much the natural hierarchy
First of all, I need to say that my English is not good. So

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.