Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Help with C++ <ctime>

Reply
Thread Tools

Help with C++ <ctime>

 
 
B Williams
Guest
Posts: n/a
 
      07-10-2006
I have been searching the internet trying to find the definition for the
function time() in the standard library header <ctime>. Can someone help me
with this? Thanks in advance.


 
Reply With Quote
 
 
 
 
Alan Johnson
Guest
Posts: n/a
 
      07-10-2006
B Williams wrote:
> I have been searching the internet trying to find the definition for the
> function time() in the standard library header <ctime>. Can someone help me
> with this? Thanks in advance.
>
>


std::clock_t std::time(std::clock_t * tloc) ;

Returns the number of seconds since the Epoch (midnight, Jan 1, 1970).
If tloc is not NULL, it also writes the same value to the location
provided by the parameter.

--
Alan Johnson


 
Reply With Quote
 
 
 
 
B Williams
Guest
Posts: n/a
 
      07-10-2006

"Alan Johnson" <(E-Mail Removed)> wrote in message
news:e8sc9d$8cl$(E-Mail Removed)...
>B Williams wrote:
>> I have been searching the internet trying to find the definition for the
>> function time() in the standard library header <ctime>. Can someone help
>> me with this? Thanks in advance.

>
> std::clock_t std::time(std::clock_t * tloc) ;
>
> Returns the number of seconds since the Epoch (midnight, Jan 1, 1970). If
> tloc is not NULL, it also writes the same value to the location provided
> by the parameter.
>
> --
> Alan Johnson
>

Thanks Alan,
I really appreciate it.


 
Reply With Quote
 
Default User
Guest
Posts: n/a
 
      07-10-2006
B Williams wrote:

> I have been searching the internet trying to find the definition for
> the function time() in the standard library header <ctime>. Can
> someone help me with this? Thanks in advance.



What do you mean by "definition"?




Brian
 
Reply With Quote
 
Jack Klein
Guest
Posts: n/a
 
      07-10-2006
On Sun, 09 Jul 2006 18:59:09 -0700, Alan Johnson
<(E-Mail Removed)> wrote in comp.lang.c++:

> B Williams wrote:
> > I have been searching the internet trying to find the definition for the
> > function time() in the standard library header <ctime>. Can someone help me
> > with this? Thanks in advance.
> >
> >

>
> std::clock_t std::time(std::clock_t * tloc) ;
>
> Returns the number of seconds since the Epoch (midnight, Jan 1, 1970).
> If tloc is not NULL, it also writes the same value to the location
> provided by the parameter.


time() returns type time_t.

clock() returns type clock_t.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
 
Reply With Quote
 
Alan Johnson
Guest
Posts: n/a
 
      07-10-2006
Jack Klein wrote:
> On Sun, 09 Jul 2006 18:59:09 -0700, Alan Johnson
> <(E-Mail Removed)> wrote in comp.lang.c++:
>
>> B Williams wrote:
>>> I have been searching the internet trying to find the definition for the
>>> function time() in the standard library header <ctime>. Can someone help me
>>> with this? Thanks in advance.
>>>
>>>

>> std::clock_t std::time(std::clock_t * tloc) ;
>>
>> Returns the number of seconds since the Epoch (midnight, Jan 1, 1970).
>> If tloc is not NULL, it also writes the same value to the location
>> provided by the parameter.

>
> time() returns type time_t.
>
> clock() returns type clock_t.
>


Correct. Apologies for the misinformation.

--
Alan Johnson
 
Reply With Quote
 
Default User
Guest
Posts: n/a
 
      07-10-2006
Alan Johnson wrote:

> B Williams wrote:
> > I have been searching the internet trying to find the definition
> > for the function time() in the standard library header <ctime>.
> > Can someone help me with this? Thanks in advance.

>
> std::clock_t std::time(std::clock_t * tloc) ;
>
> Returns the number of seconds since the Epoch (midnight, Jan 1,
> 1970). If tloc is not NULL, it also writes the same value to the
> location provided by the parameter.


As Jack mentioned, this is the wrong declaration. You are also
incorrect in the semantics. There's no requirement that time() return
seconds, certainly not seconds since the epoch. That happens to be
common, but portable should not rely on that or need that.



Brian
 
Reply With Quote
 
sonison.james@gmail.com
Guest
Posts: n/a
 
      07-10-2006
You can locate the ctime header file using "locate" or "find" commands
on UNIX

Thanks and regards
SJ

Default User wrote:
> B Williams wrote:
>
> > I have been searching the internet trying to find the definition for
> > the function time() in the standard library header <ctime>. Can
> > someone help me with this? Thanks in advance.

>
>
> What do you mean by "definition"?
>
>
>
>
> Brian


 
Reply With Quote
 
Ron Natalie
Guest
Posts: n/a
 
      07-10-2006
Default User wrote:

>
> As Jack mentioned, this is the wrong declaration. You are also
> incorrect in the semantics. There's no requirement that time() return
> seconds, certainly not seconds since the epoch. That happens to be
> common, but portable should not rely on that or need that.
>

Correct, time_t's encoding is not specified. All you can do is
pass it to otherf unctions. If you want to know elapsed time
from some point, use difftime().
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Help Help Pentax S5i Help needed (Please) The Martian Digital Photography 14 06-20-2008 07:56 AM
HELP - HELP - HELP =?Utf-8?B?S2ltb24gSWZhbnRpZGlz?= ASP .Net 4 03-09-2006 12:46 PM
HELP WANTED HELP WANTED HELP WANTED Harvey ASP .Net 1 07-16-2004 01:12 PM
HELP WANTED HELP WANTED HELP WANTED Harvey ASP .Net 0 07-16-2004 10:00 AM
HELP! HELP! HELP! Opening Web Application Project Error =?Utf-8?B?dHJlbGxvdzQyMg==?= ASP .Net 0 02-20-2004 05:16 PM



Advertisments