On 2 Jan 2006 02:39:23 -0800, "babak" <babak.ayani@gmail.com> wrote in
comp.lang.c++:
[color=blue]
> Jack,
> time() does not work in VS2005 (or at least not in my environment).
> Otherwise I would ofcourse have used it.[/color]
Surely you are doing something wrong. time() works on every
conforming C and C++ implementation in existence.
I just built and ran this console application on VS2005 beta 2 (I
haven't gotten around to removing it and installing the release
version):
#include <stdio.h>
#include <time.h>
int main(void)
{
time_t time1 = time(NULL);
struct tm time2 = *localtime(&time1);
printf("%s\n", asctime(&time2));
return 0;
}
And here is the output in the console window:
Mon Jan 02 15:03:18 2006
Press any key to continue . . .
So if time() does not work for you, there is something wrong with your
installation or your program.
[color=blue]
> I will sent my question to a windows group and hope for better luck
> there.
>
> /Babak
>
> Jack Klein skrev:
>[color=green]
> > On 2 Jan 2006 02:00:44 -0800, "babak" <babak.ayani@gmail.com> wrote in
> > comp.lang.c++:
> >[color=darkred]
> > > Hi
> > > I have a rather simple question that I haven't succeded to find the
> > > answer for in MSDN or other help pages.
> > > I'm using _time64() in VS2005 and I need to know what the return value
> > > of that function is. More precisely, which of the following is correct:
> > >
> > > 1. DWORD temp = _time64(0);
> > > 2. DWORD temp = (_time64(0) >> 32);
> > > or
> > > 3. DWORD temp = (DWORD)_time64(0);
> > >
> > > where DWORD is an unsigned long (32 bits).
> > >
> > > Thanks for your help.
> > >
> > > Regards.
> > > /Babak[/color]
> >
> > The _time64() function is not part of the C++ language, it is a
> > non-standard, Windows specific extension, so it's off-topic here and
> > you should be asking about it in a Windows programming group.
> >
> > But these pages seem to make it pretty clear:
> >
> >
http://msdn.microsoft.com/library/de.../_crt_time.asp
> >
http://msdn.microsoft.com/library/de...dard_Types.asp
> >
> > By the way, if you only want 32 bits of time resolution, you are
> > calling the wrong function. Instead of calling a 64 bit function and
> > throwing away half the result, you could call the standard time()
> > function instead.[/color][/color]
--
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