473,386 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Return value of _time64()

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

Jan 2 '06 #1
5 5430
On 2 Jan 2006 02:00:44 -0800, "babak" <ba*********@gmail.com> wrote in
comp.lang.c++:
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


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.

--
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
Jan 2 '06 #2
Jack,
time() does not work in VS2005 (or at least not in my environment).
Otherwise I would ofcourse have used it.
I will sent my question to a windows group and hope for better luck
there.

/Babak

Jack Klein skrev:
On 2 Jan 2006 02:00:44 -0800, "babak" <ba*********@gmail.com> wrote in
comp.lang.c++:
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


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.

--
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


Jan 2 '06 #3
On 2 Jan 2006 02:39:23 -0800, "babak" <ba*********@gmail.com> wrote in
comp.lang.c++:
Jack,
time() does not work in VS2005 (or at least not in my environment).
Otherwise I would ofcourse have used it.
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.
I will sent my question to a windows group and hope for better luck
there.

/Babak

Jack Klein skrev:
On 2 Jan 2006 02:00:44 -0800, "babak" <ba*********@gmail.com> wrote in
comp.lang.c++:
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


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.


--
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
Jan 2 '06 #4

babak wrote in message
<11**********************@g44g2000cwa.googlegroups .com>...
Jack,
time() does not work in VS2005


Did you bother to :

#include <ctime>
Do NOT top-post, and trim everything you are not replying to.
comp.lang.c++ http://www.parashift.com/c++-faq-lite/

--
Bob R
POVrookie
Jan 2 '06 #5
>
Surely you are doing something wrong. time() works on every
conforming C and C++ implementation in existence.


Just to follow up on this you must notice that standard time_t in VS 2005 is
64 bit and thus will call the 64 bit time(). If you want to use the "normal"
32 bit you must define the macro _USE_32BIT_TIME_T. Prior versions of VS
only had 32 bit time.

-- John
Jan 5 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Nerox | last post by:
Hi, If i write: #include <stdio.h> int foo(int); int main(void){ int a = 3; foo(a); }
12
by: Jose Fernandez | last post by:
Hello. I'm building a web service and I get this error. NEWS.News.CoverNews(string)': not all code paths return a value This is the WebMethod public SqlDataReader CoverNews(string Sport)...
3
by: tshad | last post by:
I am trying to set up a class to handle my database accesses. I can't seem to figure out how to get the return value from my dataReader from these routines (most of which I got elsewhere). They...
12
by: Michael Maes | last post by:
Hello, I have a BaseClass and many Classes which all inherit (directly) from the BaseClass. One of the functions in the BaseClass is to (de)serialize the (inherited) Class to/from disk. ...
20
by: lovecreatesbeauty | last post by:
Hello experts, Is the following code snippet legal? If it is, how can exit() do the keyword return a favor and give a return value to the main function? Can a function call (or only this...
6
by: Tim Roberts | last post by:
I've been doing COM a long time, but I've just come across a behavior with late binding that surprises me. VB and VBS are not my normal milieux, so I'm hoping someone can point me to a document...
2
by: philip | last post by:
hello, i am new to asp.net and sql server, and i have 3 questions for asking: 1. i am writing a store procedure of login validation for my asp.net application and wondering what the different...
3
by: BombDrop | last post by:
Can any one help I have a method that will return a List to be bound as a datasource to a combobox see code for population below. I get the following error when i try to compile Error 29 ...
6
KoreyAusTex
by: KoreyAusTex | last post by:
If anyone can help me figure out the what the missing return statements are, I think it might be the fact that I need to add a return false in the getValue()? import java.util.*; public class...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.