[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: [PROG] Tiden siden 1970



In article <sslug@sslug> you wrote:
> Hvordan finder jeg tiden siden 1970 i C ?

Jeg cc'er også til cprog listen, da dette er C-relateret...

Se "man 2 time" og manualsider til localtime(), gmtime(), strftime() mv.

eksempel sakset fra et program jeg lavede engang:

char time_stamp[32];
struct tm today_now;

void set_time_stamp() {
  time_t t;
  if (time(&t) == ((time_t)-1)  ) {
    //error;
    strcpy(time_stamp,"----.--.-- --:--:-- ");
  } else {
    today_now = *localtime(&t);
    strftime(time_stamp,31,"%Y.%m.%d %H:%M:%S ",&today_now);
  }
}


 

-- 
Frank Damgaard 



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