Sometimes you need to convert Mikrotik time notation in seconds, eg Uptime is delivered in this format “2w5d18: 22:18”, the next is to take that string to seconds.
Aveces es necesario pasar la notación de tiempo de Mikrotik a segundos, por ejemplo el Uptime es entregado en este formato “2w5d18:22:18”, el siguiente es para llevar ese string a un segundos.
Tested on → 4.17, 5.26, 6.1, 6.9
Probado en → 4.17, 5.26, 6.1, 6.9
:global UptimeSeconds 0;
:local uptime [/system resource get uptime];
:local weekend 0;
:local dayend 0;
:set UptimeSeconds [(((((($weeks864007)+($days86400))+($hours3600))+($minutes*60))+$seconds))];In my case I need that value in some scripts, then I run it through a scheduler every 5 seconds and the uptime in seconds it is available in a global variable for other scripts.
En mi caso necesito ese valor en algunos Scripts, entonces, mediante un scheduler lo ejecuto cada 5 segundos y el uptime en segundos esta disponible en una variable global para otros scripts.