Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / October 2007

Tip: Looking for answers? Try searching our database.

about time and time_t

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
George - 29 Oct 2007 09:26 GMT
Hello everyone,

In MSDN for time function,

time_t time(
  time_t *timer
);

http://msdn2.microsoft.com/en-us/library/1f4c8f33(VS.80).aspx

the return value of time is time_t, but in the Return Value section, it
mentioned,

Return the time as seconds elapsed since midnight, January 1, 1970. There is
no error return.

So, I am wondering whether time_t could be represented as elapsed number of
seconds correctly and safely -- no data lost if we convert return value to
unsigned long?

Like,

unsigned long second = time (NULL);

thanks in advance,
George
David Lowndes - 29 Oct 2007 11:15 GMT
>In MSDN for time function,
>
[quoted text clipped - 13 lines]
>seconds correctly and safely -- no data lost if we convert return value to
>unsigned long?

George,

time_t is (in later compilers) defined as a 64-bit value (with the
option of being a 32-bit value for backward compatibility). It's best
if you play by the rules and use it with appropriate functions such as
difftime.

Dave

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.