Thread: system time

  1. #1
    jpre
    Guest

    system time

    How can I get the system time , is it in time.h
    is there a way to get the date
    thanx

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > is it in time.h
    like ctime() and strftime() perhaps

    Most functions in the standard .h files have an associated manual page.

    Reading a .h file, and skimming the manual pages would be a good idea. You won't remember the detail, but you will remember seeing something, and know roughly where to start looking for the detail when you next need it.
    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.

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    156
    Try this:

    Code:
    #include <time.h>
    #include <stdio.h>
    
    void main( void )
    {
       time_t ltime;
    
       time( &ltime );
       printf( "The time is %s\n", ctime( &ltime ) );
    }

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, 07: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, 06: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