Thread: Milliseconds?

  1. #1
    Registered User
    Join Date
    Aug 2010


    Hi. in many languages, there is a functions that will return an integer representing the number of milliseconds that the PC has been on. I am having trouble finding a similar function in c++. I've searched Google and could not find what I was looking for.

    Any help would be greatly appreciated.

  2. #2
    Registered User
    Join Date
    Dec 2007
    Windows 10 with Visual Studio 14.0.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    > I am having trouble finding a similar function in c++
    Well there isn't one in standard C++.

    Which means that if Ducky's guess that you're using windows is wrong, then you need to tell us which OS/Compiler you are using.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Aug 2010
    I'm using windows with code::blocks and mingw, but i am writing a multi-platform app.

  5. #5
    Join Date
    Oct 2007
    Inside my computer
    There is no multi-platform function. You're going to have to wrap your function calls to your own function, say, GetMilliSecSinceBoot. Then put a couple of typedefs there to call and appropriate function for any given platform. GetTickCount is for Windows.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Time in milliseconds
    By coder_009 in forum C Programming
    Replies: 4
    Last Post: 05-09-2008, 03:36 AM
  2. text comparing
    By Picachu in forum C Programming
    Replies: 48
    Last Post: 12-14-2006, 03:44 AM
  3. Current System Time (In Milliseconds)
    By IGAU in forum C Programming
    Replies: 10
    Last Post: 03-30-2004, 06:53 PM
  4. Time in milliseconds?
    By d00b in forum C++ Programming
    Replies: 3
    Last Post: 08-05-2002, 09:33 PM
  5. Milliseconds
    By Magos in forum C++ Programming
    Replies: 8
    Last Post: 11-01-2001, 03:13 PM