Hi everyone.
I am not sure how many XPlane users are active here but just in case some may be able to use it, I posted the message from XPlane.org, here also.
This is somewhat equivalent to the Time Stay available for FSX.

>>
I was able to find way to get the TimeStay to work. I tried many different approaches but they all has some unwanted side effects. The script below works but it may be system dependent, some experimentation by the User may be needed.

I am sure there better implementations but I have a very difficult time finding documentation that gels / connects all the available information. There seem to be many gaps in the documentation that is only known / found if you already know / are familiar with the intricacies of XPlane.

To use copy the text below the TimeStay. lua into a text file, called TimeStay.lua or whatever you want to call it and place it into your X:....\X-Plane 11\Resources\plugins\FlyWithLua\Scripts and Start XPlane. Your Local time, as shown in teh lower right of the C172 G1000 should stay about the same. It should not affect any thing else in the way the sim operates. If Errors found, or have recommendations / suggestions, post here.

To disable the script you can change the extension to something like "TimeStay. lua.dis" or remove the Script from your folder / directory.

TimeStay. lua



--Move Local Time back, TimeStay within the same minute.
--Use if you only like to fly at certain times, like Sunset..
--Note: It may be system dependent change set_back= value if needed.

local start_time = os.clock()
local set_back = 20

function stay_time()
if os.clock() > (start_time + set_back) then
command_once("sim/operation/time_down")
start_time = os.clock()
end
end
do_often("stay_time()")