Getting last system reboot time - C

This is a discussion on Getting last system reboot time - C within the Windows Programming forums, part of the Platform Specific Boards category; is there a C function or object I can use to retrieve the time of the last system boot on ...

  1. #1
    Registered User Markallen85's Avatar
    Join Date
    Nov 2002
    Posts
    53

    Getting last system reboot time - C

    is there a C function or object I can use to retrieve the time of the last system boot on a win 2k server?

    I've tried digging around the msdn library, but I can't find anything there, or in the search for this forum. I'm also checking out the windows registry to see if there's any keys for it there, but it'd be nice if someone knew where I should be looking.

    thanks in advance
    -mark
    "never argue with an idiot, they will drag you down to their level and beat you with experience"

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    22
    The GetTickCount function retrieves the number of milliseconds that have elapsed since the system was started. Use a little math if you need dates or daytime.
    It's limited to 49 days but I doubt if any MS product could work that long without rebooting .

  3. #3
    Registered User Markallen85's Avatar
    Join Date
    Nov 2002
    Posts
    53
    thanks, that should do for now, though it'd be cool if I could find a longer term function.

    This is running on a load of win2k servers, most are set to reboot every weekend, but two of them have now been up for several 1000 consecutive hours.... that is until I get on them and seriously screw up some code

    thanks
    -mark
    "never argue with an idiot, they will drag you down to their level and beat you with experience"

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    No modern Microsoft OS has ever gone 49 days without needing a critical security update.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Read and set\change system time
    By Hexxx in forum C++ Programming
    Replies: 9
    Last Post: 01-02-2006, 06:11 AM
  2. Replies: 3
    Last Post: 06-13-2005, 07:28 AM
  3. Current System Time (In Milliseconds)
    By IGAU in forum C Programming
    Replies: 10
    Last Post: 03-30-2004, 05:53 PM
  4. how to ouput system date and time?
    By toaster in forum C++ Programming
    Replies: 1
    Last Post: 04-21-2002, 10:58 PM
  5. Passing system time to a function
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 02-14-2002, 12:56 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21