Community discussions

MikroTik App
 
gnando
just joined
Topic Author
Posts: 21
Joined: Tue May 02, 2006 12:22 am

Take Time System

Mon Jul 03, 2006 4:32 pm

hello to all my question it is the following one since I can make to keep in a variable of type time the present hour from the system?

this commando works but I have left of type string

:global t1 [ :totime [:set tmp [ /system clock get time]]]

:put [:typeof t1]
str


thanks and pardon but my ingles is not good
 
User avatar
Eugene
Forum Veteran
Forum Veteran
Posts: 986
Joined: Mon May 31, 2004 5:06 pm
Location: Cranfield, UK

Tue Jul 04, 2006 9:58 am

[ /system clock get time] works as a time value, e.g.:

/system clock set time [ /system clock get time]
 
gnando
just joined
Topic Author
Posts: 21
Joined: Tue May 02, 2006 12:22 am

Tue Jul 04, 2006 1:28 pm

hello

a) :global t1 [ /system clock get time]

b) :environment print
t1=08:53:48

c) :put [:typeof t1]
str

the result must be time not str

thanks to respond!
 
User avatar
Eugene
Forum Veteran
Forum Veteran
Posts: 986
Joined: Mon May 31, 2004 5:06 pm
Location: Cranfield, UK

Tue Jul 04, 2006 1:35 pm

it works anyways.
 
gnando
just joined
Topic Author
Posts: 21
Joined: Tue May 02, 2006 12:22 am

var tipe time sum and substractions

Tue Jul 04, 2006 4:08 pm

Hello!
If but I need that it is a veriable of type time because I want to make sum and subtractions of time
 
User avatar
Eugene
Forum Veteran
Forum Veteran
Posts: 986
Joined: Mon May 31, 2004 5:06 pm
Location: Cranfield, UK

Wed Jul 05, 2006 8:36 am

[admin@top] > :put [:totime $t1]                                                                                                      
22:27:03
[admin@top] > :put ([:totime $t1] - 1)                                                                                                
22:27:02
[admin@top] > :put ([:totime $t1] - 1:00)                                                                                             
21:27:03
[admin@top] > :put ([:totime $t1] - 00:1:00)                                                                                          
22:26:03
[admin@top] > 
Hope this helps.

Eugene