1
0
This commit is contained in:
Daniel Tartavel 2020-05-08 13:52:11 +02:00
parent a1d404435d
commit 3ff3148e78

22
main.c
View File

@ -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