This should probably be a Gateway Scheduled Event Script.
Either way, I just learned about a better way of doing this:
Note that unless you have filtered the code prior to the code you shared, it will execute when the value changes, but also when the quality changes, so you probably want to insure that the value has actually made a False to True transition.
Also, verify that your Gateway, Database, and Local machine all have the same Date Time settings.