Thread: current time

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    88

    current time

    i am trying to get the current time of day (calender time)

    Code:
    time_t current;
    ...
    time(current);
    now where would the time be stored as an ascii string. what i really wanna do is send() so i have my own timeserver.

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Well, you probably don't want to send the date in string format. Send it/store it as a time_t (unsigned int??). But whatever, use ctime() or similar (you should browse time.h, too...). Remember, that ctime() returns a static buffer that will be overwritten in subsequent calls - be sure to copy the data immediately, and not simply store pointers to the returned strings...
    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 Cela's Avatar
    Join Date
    Jan 2003
    Posts
    362
    >>now where would the time be stored as an ascii string.
    You have to ask for it by way of ctime or localtime
    Code:
    char *timestring = ctime(&current);
    *Cela*

  4. #4
    Registered User
    Join Date
    Jan 2003
    Posts
    88
    thx for the response guys... i got it

    Sebsatiani, i think u think that i am more advanced than i really am. in some time ill look back on what you said and see if i understand it. thx still.

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. Military Time Functions
    By BB18 in forum C Programming
    Replies: 6
    Last Post: 10-10-2004, 01:57 PM
  3. Killing someones grandparents
    By nickname_changed in forum A Brief History of Cprogramming.com
    Replies: 37
    Last Post: 09-07-2003, 07:56 AM
  4. Is this really true or it's just science fiction?
    By Nutshell in forum A Brief History of Cprogramming.com
    Replies: 145
    Last Post: 04-09-2002, 06:17 PM
  5. time class
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 12-11-2001, 10:12 PM