[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] Date/time funktioner



Lige en velment advarsel. Både "strfrime" og også "localtime" (som godt
nok bruges på en helt anden måde) giver at året lige nu er 101, og ikke
bare 1. Jeg måtte droppe strftime for nylig og bruge localtime for at
kunne rette i årstallet.

Med venlig hilsen
Søren H. Sørensen

"Egon Andersen, Talura" wrote:
> 
> Bjarke Bruun wrote:
> >
> > Jeg har et skole program som vi er flere til at udvikle. Nogle sider på
> > windows og andre på linux. Det giver nogle problemer eg. conio.h getch()
> > osv, men det er ikke det værste.
> >
> > Jeg mangler nogle dato/tids funktioner, da der skal laves en lokal (ikke
> > med syslog) logfil med data og tid i, men jeg kan ikke finde nogen
> > egentlig info om det og time.h er ikke den mest oplysende man sider jeg
> > har set længe.
> >
> > windows koden ser såleds ud:
> >
> > --
> > int w,m,y;
> > struct date d;
> > getdate(&d);
> > w=d.da_day;m=d.da_mon;y=d.da_year;
> > --
> >
> > Er det nogen linux "variant" af denne?
> 
> getdate() er ikke nogen standard funktion!
> 
> Hva' med ISO-C standard?
> Prøv:
> 
> #include <time.h>
> char timestring[21];
> time_t timestamp;
> timestamp = time(NULL);
> strftime(timestring, 20, "%Y-%m-%d %k:%M:%S", gmtime(&timestamp));
> 
> /Egon


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *