debug
This commit is contained in:
parent
a1d404435d
commit
3ff3148e78
22
main.c
22
main.c
@ -23,6 +23,26 @@ int isinarray( int pid, int array[], int n )
|
|||||||
} return 0;
|
} 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
|
//get utmp datas
|
||||||
void getutmp( int pid, char user[], char host_ip[], char host_ipv6[], time_t * time )
|
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 );
|
time( &timet );
|
||||||
}
|
}
|
||||||
sprintf( date, "%s", ctime(&timet) );
|
sprintf( date, "%s", frtime(&timet) );
|
||||||
date[strlen(date)-1] = 0;
|
date[strlen(date)-1] = 0;
|
||||||
|
|
||||||
//get the pid of the last processus
|
//get the pid of the last processus
|
||||||
|
Reference in New Issue
Block a user