t := time.Now()
formatted := fmt.Sprintf("%d-%02d-%02dT%02d:%02d:%02d",
t.Year(), t.Month(), t.Day(),
t.Hour(), t.Minute(), t.Second())
-
https://stackoverflow.com/questions/20234104/how-to-format-current-time-using-a-yyyymmddhhmmss-formatOn recupere le pid du processus qui a ouvert la socket :
netstat -laptun
Puis :
$ ps -eo pid,etime | grep 8084
8084 3-02:02:59
ici 3 jours, 2 heures, 2 minutes...!
-
https://links.infomee.fr/?ef8W_gUne fonction pour calculer le temps écoulé entre 2 timestamp
-
http://aidanlister.com/2004/04/making-time-periods-readable/