Thread: [Dev-C++] QUESTION ABOUT DATE
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: FABIAN H. <fhu...@ho...> - 2003-03-19 23:23:31
|
Hello every body: I've got a question, so stupid but here is, which function(in what header is defined and what struct i have to use) can I use that let me get the current date and time. Sorry if this question is so stupid but I need to know. i tried with time.h where there is a definition of some structure than store a date but i did not find some function like "getdate". Fabian _________________________________________________________________ Charla con tus amigos en línea mediante MSN Messenger: http://messenger.yupimsn.com/ |
|
From: Ricardo R. <ri...@po...> - 2003-03-20 09:49:45
|
You can have different solutions as indicated in Schildt's book.
For instance, one of them is:
*********************
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
struct tm *punt;
time_t lt;
lt=time(NULL);
punt=localtime(<);
printf(asctime(punt));
system("PAUSE");
return 0;
}
**********************
(1) time( ) gives the actual date and hour in a struct of type time_t;
(2) localtime( ) separates the local time of the struct "lt" in a
struct of type tm.
(3) asctime( ) converts this information in a char array with the format:
day month date hour: minutes:seconds year \n\0
I hope this can help you.
Ricardo.
|
|
From: Per W. <pw...@ia...> - 2003-03-20 10:27:36
|
Actually time_t is normally an integer storing number of seconds since
1970.
localtime converts the number of seconds to a struct tm with time adjusted
for time zone and daylight savings.
gmtime converts the same number of seconds to a struct tm filled in with
UTC time, i.e. time-zone GMT without daylight savings.
For some systems, you might also do gettimeofday() to get sub-second time
resolution.
/Per W
On Thu, 20 Mar 2003, Ricardo L=F3pez Ruiz wrote:
> You can have different solutions as indicated in Schildt's book.
> For instance, one of them is:
>
> *********************
> #include <stdio.h>
> #include <stdlib.h>
> #include <time.h>
>
> int main()
> {
> struct tm *punt;
> time_t lt;
>
> lt=3Dtime(NULL);
> punt=3Dlocaltime(<);
> printf(asctime(punt));
>
> system("PAUSE");
> return 0;
> }
> **********************
>
> (1) time( ) gives the actual date and hour in a struct of type time_t;
> (2) localtime( ) separates the local time of the struct "lt" in a
> struct of type tm.
> (3) asctime( ) converts this information in a char array with the format:
> day month date hour: minutes:seconds year \n\0
>
> I hope this can help you.
>
> Ricardo.
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Tablet PC.
> Does your code think in ink? You could win a Tablet PC.
> Get a free Tablet PC hat just for playing. What are you waiting for?
> http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: David M. <ci...@ya...> - 2003-03-20 13:02:52
|
I am assisting with a project that I believe will benifit from the use of threads. However the group that I am working with does not want tolose portability just to get threads. What portable thread packages are avalible and are there any success stories that anyone on the list has had with these various packages. Thanks in advance David McKen __________________________________________________ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com |
|
From: Per W. <pw...@ia...> - 2003-03-20 13:53:01
|
wxWindows contains an encapsulation looking very much like pThreads. It works on most OS. /Per W On Thu, 20 Mar 2003, David McKen wrote: > I am assisting with a project that I believe will benifit > from the use of threads. However the group that I am > working with does not want tolose portability just to get > threads. What portable thread packages are avalible and are > there any success stories that anyone on the list has had > with these various packages. > > Thanks in advance > David McKen > > __________________________________________________ > Do you Yahoo!? > Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! > http://platinum.yahoo.com > > > ------------------------------------------------------- > This SF.net email is sponsored by: Tablet PC. > Does your code think in ink? You could win a Tablet PC. > Get a free Tablet PC hat just for playing. What are you waiting for? > http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Daniel K. O. <dan...@ya...> - 2003-03-20 20:13:56
|
GLib has a threads library: "Threads thread abstraction; including threads, different mutexes, conditions and thread private data." Download it from www.gtk.org, or the pre-compiled at www.gimp.org/win32 The API is also available at http://developer.gnome.org/doc/API/2.0/glib/glib-Threads.html (just in case you want to check out before downloading it) Daniel K. O. It's OK to be ignorant; it's not OK to play stupid. http://www.catb.org/~esr/faqs/smart-questions.html > -----Mensagem original----- > De: dev...@li... > [mailto:dev...@li...]Em nome de David McKen > Enviada em: quinta-feira, 20 de março de 2003 10:03 > Para: Dev-C Mailing List > Assunto: [Dev-C++] Portble Threads (is there really such a thing?) > > > I am assisting with a project that I believe will benifit > from the use of threads. However the group that I am > working with does not want tolose portability just to get > threads. What portable thread packages are avalible and are > there any success stories that anyone on the list has had > with these various packages. > > Thanks in advance > David McKen |
|
From: David M. <ci...@ya...> - 2003-03-20 13:04:50
|
Check this site out http://www.cplusplus.com/ref/ctime/ I believe that will help you out. :) --- FABIAN HUENUMAN <fhu...@ho...> wrote: > > Hello every body: > I've got a question, so stupid but here is, which > function(in what header is > defined and what struct i have to use) can I use that > let me get the > current date and time. > Sorry if this question is so stupid but I need to know. > i tried with time.h where there is a definition of some > structure than > store a date but i did not find some function like > "getdate". > Fabian > > > > > > _________________________________________________________________ > Charla con tus amigos en línea mediante MSN Messenger: > http://messenger.yupimsn.com/ > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Does your code think > in ink? > You could win a Tablet PC. Get a free Tablet PC hat just > for playing. > What are you waiting for? > http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users __________________________________________________ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com |