Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[open] Universal Time Stamps in 0.26

edited September 2012 in OpenSesame

Hey Sebastiaan,

I'm trying to synchronize outputs from Open Sesame with outputs from other programs, so I was wondering if there is a way to log a time stamp with each response in universal time format.
Do you think you could help me out?
Thanks so much.

-Aaron

Comments

  • edited 10:34PM

    Hi Aaron,

    Yes, that's certainly possible. You can use the Python module 'time' for this:

    If you read this documentation you can figure out what kind of time stamp is most appropriate for your purpose.

    The example below uses the function time.strftime() and returns the universal time formatted as "Mon, 10 Sep 2012 10:26:07 +0000":

    # Import module:
    import time
    
    # Get universal time stamp:
    time = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime())
    
    # And set the time, such that this variable is available in the interface
    # (e.g. the logger item) too:
    self.experiment.set("time_stamp", time)
    

    If you place an inline_script item with the above code (in the Run phase tab) immediately after the response item (but before the logger item) this will give the desired result: The variable "time_stamp" will be logged to the output file.

    And finally, please note that comparing the clocks works for very coarse synchronisation, but for more accurate synchronisation it's better to set up some sort of communication between the systems.

    I hope this helps! Please feel free to ask any further questions!

    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited 10:34PM

    Lotje,

    Thank you so much for the help! It's very much appreciated.

    Aaron

Sign In or Register to comment.