Howdy, Stranger!

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

Supported by

Globally record computer's timestamp for each item

Dear OS community, 

I am looking for a way, a script I believe, to automatically record the computer's timestamp whenever an item is introduced. That is, to create a new variable called "timestamp" that will log the computer's timestamp (using for example datetime.datetime.time(datetime.datetime.now())) of every item when it starts. for example the timestamp of fixation, timestamp of stimuli, timestamp of response, timestamp of blank screen, timestamp of logger, and then again when a new trial starts, the timestamp of fixation, timestamp of stimuli etc. 

I guess it could be done by adding an inline_script before each item but I wonder if there's a global way that will be more "parsimonious" in items. If not possible, I wonder if there's an automated way to calculate the computer's timestamp retrospectively by recording the timestamp at the end of the experiment and create the past timestamps according to the the structure of the experiment (using the time_ variables maybe?).

I'd be grateful for any help,

SH

Comments

  • Hi @S_H,

    I don't think you can achieve a programmatic way of recording the time stamp before object. If you want to record it manually, my guess is that you need to use code (python or javascript) before each object.

    However, I think you're actually trying to implement something that is already part of OS's logged variables... As far as I can tell, the logger's default settings provide a time stamp for each object. It can be found in the output file in the column corresponding to time_[item_name] (where item_name is the name of a sketchpad, sample, keyboard object or what have you). If your logger is set to log all variables, that information will be present in the output file for every single object in your experiment. If you configure your logger manually, just consult the variables explorer to select and include whatever you need in the output. You can read more about the variables and the time stamp here: https://osdoc.cogsci.nl/3.2/manual/variables/

    So, in summary, I think the most efficient solution for you is to just use OS's built-in time stamps.

    Hope this helps.

    Fabrice.

    Buy Me A Coffee

  • Hi Fabrice,

    Thank you for your detailed answer.

    Do you know what type of timestamp is logged in the time_[item]? Is there a way to convert the logged timestamp to a unix epoch clock timestamp?

    Thanks,

    SH

  • Hi @S_H,

    Not sure what type of time stamp it is (can't find that information in the documentation). Perhaps the developers can answer that. My guess, but it's only my guess, is that it is a startup timestamp and that it is in milliseconds.

    Not sure about the Unix epoch timestamp but isn't the latter the number of seconds that have elapsed since January 1, 1970 at 00:00:00 GMT? If so, I guess that you could just log the date and time of an object at the onset of the experiment and then calculate offline the Unix epoch timestamp based on the timestamp in OS.

    Good luck,

    Fabrice.

    Buy Me A Coffee

  • Thanks @Fab !

Sign In or Register to comment.