Thread: How do i use add time?

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    8

    How do i use add time?

    How do i put time in my programs? Do you have to use time.h and what functions should i use?

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    This code will initialize and return to the variable "Time" a pointer to a struct tm containing the current time. Just look in time.h and examine this "tm" structure to see what fields are there to extract.

    Hope this helps.

    Code:
    struct tm *Time;
    time_t timenow;
    time(&timenow);
    Time = localtime(&timenow);
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  3. #3
    Registered User
    Join Date
    Sep 2002
    Posts
    72
    Code:
    #include <time.h>
    #include <iostream.h>
    int main(void)
    
    {
    
          time_t t = time(NULL);   //calls time function
          cout << ctime(&t) << endl;   //display of time
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Journey time prog 1 minute wrong
    By mike_g in forum C Programming
    Replies: 4
    Last Post: 10-12-2006, 03:41 AM
  2. Time conversions
    By mariabair in forum C++ Programming
    Replies: 2
    Last Post: 01-02-2004, 04:55 PM
  3. calculating user time and time elapsed
    By Neildadon in forum C++ Programming
    Replies: 0
    Last Post: 02-10-2003, 06:00 PM
  4. time class
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 12-11-2001, 10:12 PM