diff --git a/main.c b/main.c index caffc26..35e2b60 100644 --- a/main.c +++ b/main.c @@ -23,6 +23,26 @@ int isinarray( int pid, int array[], int n ) } return 0; } +char* frtime(const time_t timet) +{ + int jour; + struct tm *date_tm; + + static const char nomjour[][10] = { + "Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi" + }; + static const char nommois[][10] = { + "Janvier", "Fevrier", "Mars", "Avril", "Mai", "Juin", + "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre" + }; + static char result[40]; + date_tm = localtime(&timet); + strftime(result, 4, "%w", date_tm); + jour = atoi(result); + strftime(result, 40, "%Ec", date_tm); + return result; +} + //get utmp datas void getutmp( int pid, char user[], char host_ip[], char host_ipv6[], time_t * time ) { @@ -156,7 +176,7 @@ int getprocinfo( int ppid, char cmdline[], char cmd[], char user[], char host_ip { time( &timet ); } - sprintf( date, "%s", ctime(&timet) ); + sprintf( date, "%s", frtime(&timet) ); date[strlen(date)-1] = 0; //get the pid of the last processus