Get current system time from python

Hi Chris,

Is there a way to request MWorks system time from within python? I have come up with a cumbersome solution, but it’s not ideal because it’s causing some delay:

MWorks

get_time = False {
    current_time = now()
}

Python

def get_time()
    setvar ('get_time', True)
    return getvar ('current_time', True)

current_time = get_time()

Thanks!

Best,
Vladyslav

Hi Vladyslav,

Is there a way to request MWorks system time from within python?

There is, but at present it’s only in the MWorks nightly build. The function is called get_current_time_us.

Cheers,
Chris

1 Like