time of system

This is a discussion on time of system within the C++ Programming forums, part of the General Programming Boards category; hello . is there any function that returns the system time ? for example when it is 8:30 , it ...

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    177

    time of system

    hello .
    is there any function that returns the system time ?
    for example when it is 8:30 , it returns 8-30.
    if yes can I use the value that the function has returned (in the above example 8 & 30) in another proces as
    int numbers ?
    thanks .

  2. #2
    Registered User Draco's Avatar
    Join Date
    Apr 2002
    Posts
    463
    take a look at the standard c header time.h it should have all you need. It is impossible to directly get a time number as an int, it cant hold the numbers. You have to convert it into an int.

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >for example when it is 8:30 , it returns 8-30
    Is this just an example, or is it what you need? The <ctime> functions return a value that fits within the type time_t, and carries considerably more information than just the hour and minute. You can use other <ctime> functions and types to get what you want out of it though.
    My best code is written with the delete key.

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    See the FAQ and cppreference.com.

    [EDIT] - And, get a book! The basics of <ctime> should be covered any beginning C++ book.

    BTW - In order to completely understand the <ctime> functions, you have to understand pointers and structures which should also be covered in any beginning C++ book.
    Last edited by DougDbug; 12-10-2003 at 12:39 PM.

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: 4
    Last Post: 06-13-2005, 09:03 AM
  3. Current System Time (In Milliseconds)
    By IGAU in forum C Programming
    Replies: 10
    Last Post: 03-30-2004, 05:53 PM
  4. I apologize. Good bye.
    By doubleanti in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 05-03-2002, 06:51 PM
  5. how to ouput system date and time?
    By toaster in forum C++ Programming
    Replies: 1
    Last Post: 04-21-2002, 10:58 PM

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