﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Millisecond Forums » Millisecond Forums » Inquisit 5  » millisecond timing precision</title><generator>InstantForum 2017-1 Final</generator><description>Millisecond Forums</description><link>https://forums.millisecond.com/</link><webMaster>Millisecond Forums</webMaster><lastBuildDate>Thu, 30 Apr 2026 12:25:26 GMT</lastBuildDate><ttl>20</ttl><item><title>millisecond timing precision</title><link>https://forums.millisecond.com/Topic34910.aspx</link><description>hello,&amp;nbsp;&lt;br/&gt;&lt;br/&gt;i am running an fMRI study that needs very precise timing information. i understand that the timestamps don't have mililseconds, and i've tried to use a combination of timestamps at the beginning of each trial and elapsed time during each trial to get more precise timing information. i'm noticing that the numbers aren't adding up, the difference in timestamps from start to finish do not match the sum of trial's elapsed time (and for many trials the elapsed time is below the minimum trial duration). below, i have listed 4 specific examples of what elapsed time measures i would like to be able to record.&amp;nbsp;&lt;br/&gt;&lt;br/&gt;(1) how do i record elapsed time for the posttrialpause below? (i.e., would like elapsed time that reflects the below trial duration)&lt;br/&gt;&amp;lt;openended estimate_nat&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = script.currenttime]&lt;br/&gt;/ position = (50, 50)&lt;br/&gt;/ buttonlabel = "please enter estimate"&lt;br/&gt;/ fontstyle = ("Arial",20)&lt;br/&gt;/ inputdevice = keyboard&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ stimulustimes = [0=sceneStim_current, estimateQ, leftHand, rightHand]&lt;br/&gt;/ linelength = 3&lt;br/&gt;/ range = (0,100)&lt;br/&gt;/ mask = positiveintegerorzero&lt;br/&gt;/ numlines = 1&lt;br/&gt;/ responsefontstyle = ("Arial",80)&lt;br/&gt;/ posttrialpause = 2000&lt;br/&gt;/ trialduration = 5000&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.estimate_nat.elapsedtime]&lt;br/&gt;/ branch = [&lt;br/&gt;trial.outcome_nat&lt;br/&gt;]&lt;br/&gt;&lt;br/&gt;(2) relatedly, would it be possible to have elapsed timing information for the entire trial (reflecting trial duration) and not just after the response?  &lt;br/&gt;&amp;lt;trial memStims_art_A_y_T&amp;gt;&lt;br/&gt;/ ontrialbegin = [&lt;br/&gt;&amp;nbsp; values.artSample = list.memList_imageSelect_art_A_y.nextvalue;&lt;br/&gt;&amp;nbsp; values.trialtimestamp = script.currenttime;&lt;br/&gt;]&lt;br/&gt;/ stimulustimes = [0=blank, artP; 3000=newOld, memScale, mem_leftHand, mem_rightHand]&lt;br/&gt;/ validresponse = ("0","1","2","3","4","5","6","7","8","9")&lt;br/&gt;/ beginresponsetime = 3000&lt;br/&gt;/ trialduration = 5000&amp;nbsp; &lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.memStims_art_A_y_T.elapsedtime]&lt;br/&gt;/ branch = [&lt;br/&gt;trial.mem_iti&lt;br/&gt;]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(3) this trial waits for a pretrial signal, i would like the elapsed time to reflect the time after the pretrialsignal is sent (it currently records time for the whole trial, including the time before the signal is detected). &lt;br/&gt;&amp;lt;trial new_memBlock&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = script.currenttime]&lt;br/&gt;/ stimulustimes = [0=blank,cross]&lt;br/&gt;/ trialduration = 6000&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ pretrialsignal = (keyboard,13)&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.new_memBlock.elapsedtime]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(4) is there a way to record elapsed time between trials? &lt;br/&gt;&lt;br/&gt;thank you so much, i understand this is tedious!! </description><pubDate>Tue, 08 Nov 2022 19:51:13 GMT</pubDate><dc:creator>nrouhani</dc:creator></item><item><title>RE: millisecond timing precision</title><link>https://forums.millisecond.com/Topic34919.aspx</link><description>&lt;blockquote data-id="34918" class="if-quote-wrapper" unselectable="on" data-guid="1667937062043" contenteditable="false" id="if_insertedNode_1667937061797"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34918" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34918" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34918" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Dave - 11/8/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34918"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;&lt;blockquote data-id="34917" class="if-quote-wrapper" unselectable="on" data-guid="1667937062043" id="if_insertedNode_1667934269347" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34917" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34917" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34917" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;nrouhani - 11/8/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34917"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;&lt;blockquote data-id="34915" class="if-quote-wrapper" unselectable="on" data-guid="1667937062043" id="if_insertedNode_1667934001711" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34915" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34915" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34915" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Dave - 11/7/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34915"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;&lt;blockquote data-id="34914" class="if-quote-wrapper" unselectable="on" data-guid="1667937062043" id="if_insertedNode_1667836628230" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34914" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34914" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34914" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;nrouhani - 11/7/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34914"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;&lt;blockquote data-id="34912" class="if-quote-wrapper" unselectable="on" data-guid="1667937062043" id="if_insertedNode_1667835996091" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34912" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34912" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34912" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Dave - 11/7/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34912"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;&lt;blockquote data-id="34910" class="if-quote-wrapper" unselectable="on" data-guid="1667937062043" id="if_insertedNode_1667823721818" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34910" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34910" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34910" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;nrouhani - 11/5/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34910"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;hello,&amp;nbsp;&lt;br/&gt;&lt;br/&gt;i am running an fMRI study that needs very precise timing information. i understand that the timestamps don't have mililseconds, and i've tried to use a combination of timestamps at the beginning of each trial and elapsed time during each trial to get more precise timing information. i'm noticing that the numbers aren't adding up, the difference in timestamps from start to finish do not match the sum of trial's elapsed time (and for many trials the elapsed time is below the minimum trial duration). below, i have listed 4 specific examples of what elapsed time measures i would like to be able to record.&amp;nbsp;&lt;br/&gt;&lt;br/&gt;(1) how do i record elapsed time for the posttrialpause below? (i.e., would like elapsed time that reflects the below trial duration)&lt;br/&gt;&amp;lt;openended estimate_nat&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = script.currenttime]&lt;br/&gt;/ position = (50, 50)&lt;br/&gt;/ buttonlabel = "please enter estimate"&lt;br/&gt;/ fontstyle = ("Arial",20)&lt;br/&gt;/ inputdevice = keyboard&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ stimulustimes = [0=sceneStim_current, estimateQ, leftHand, rightHand]&lt;br/&gt;/ linelength = 3&lt;br/&gt;/ range = (0,100)&lt;br/&gt;/ mask = positiveintegerorzero&lt;br/&gt;/ numlines = 1&lt;br/&gt;/ responsefontstyle = ("Arial",80)&lt;br/&gt;/ posttrialpause = 2000&lt;br/&gt;/ trialduration = 5000&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.estimate_nat.elapsedtime]&lt;br/&gt;/ branch = [&lt;br/&gt;trial.outcome_nat&lt;br/&gt;]&lt;br/&gt;&lt;br/&gt;(2) relatedly, would it be possible to have elapsed timing information for the entire trial (reflecting trial duration) and not just after the response?  &lt;br/&gt;&amp;lt;trial memStims_art_A_y_T&amp;gt;&lt;br/&gt;/ ontrialbegin = [&lt;br/&gt;&amp;nbsp; values.artSample = list.memList_imageSelect_art_A_y.nextvalue;&lt;br/&gt;&amp;nbsp; values.trialtimestamp = script.currenttime;&lt;br/&gt;]&lt;br/&gt;/ stimulustimes = [0=blank, artP; 3000=newOld, memScale, mem_leftHand, mem_rightHand]&lt;br/&gt;/ validresponse = ("0","1","2","3","4","5","6","7","8","9")&lt;br/&gt;/ beginresponsetime = 3000&lt;br/&gt;/ trialduration = 5000&amp;nbsp; &lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.memStims_art_A_y_T.elapsedtime]&lt;br/&gt;/ branch = [&lt;br/&gt;trial.mem_iti&lt;br/&gt;]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(3) this trial waits for a pretrial signal, i would like the elapsed time to reflect the time after the pretrialsignal is sent (it currently records time for the whole trial, including the time before the signal is detected). &lt;br/&gt;&amp;lt;trial new_memBlock&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = script.currenttime]&lt;br/&gt;/ stimulustimes = [0=blank,cross]&lt;br/&gt;/ trialduration = 6000&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ pretrialsignal = (keyboard,13)&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.new_memBlock.elapsedtime]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(4) is there a way to record elapsed time between trials? &lt;br/&gt;&lt;br/&gt;thank you so much, i understand this is tedious!! &lt;a class="if-quote-goto quote-link" href="#" data-id="34910"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;/ontrialend logic is executed sometime during the posttrialpause, so taking elapsed time ontrialend it does not capture the duration of the posttrialpause and is not supposed to.&lt;br/&gt;&lt;br/&gt;The most accurate measurement you can get is taking a trial N's timestamp /ontrialbegin, taking trial N+1's timestamp /ontrialbegin, and then calculating the difference. The result is the overall duration of trial N, including any posttrialpause and time "between" trials.&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="34912"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;as i have included in my example, i do include a timestamp on each trial's /ontrialbegin, it is however not in milliseconds and not as accurate as i need it to be (the timestamp is also not lining up with outside time measures) - is this my only solution? &lt;br/&gt;&lt;br/&gt;i also included three other examples in my initial question about the 'elapsed time' measure that have gone unanswered (pasted below again) - i would appreciate your input on how to deal with them (especially when the elapsed time seems to stop after a response is recorded and not record the entire trial duration). thank you&lt;br/&gt;&lt;br/&gt;(2) relatedly, would it be possible to have elapsed timing information for the entire trial (reflecting trial duration) and not just after the response?&lt;br/&gt;&amp;lt;trial memStims_art_A_y_T&amp;gt;&lt;br/&gt;/ ontrialbegin = [&lt;br/&gt;  values.artSample = list.memList_imageSelect_art_A_y.nextvalue;&lt;br/&gt;  values.trialtimestamp = script.currenttime;&lt;br/&gt;]&lt;br/&gt;/ stimulustimes = [0=blank, artP; 3000=newOld, memScale, mem_leftHand, mem_rightHand]&lt;br/&gt;/ validresponse = ("0","1","2","3","4","5","6","7","8","9")&lt;br/&gt;/ beginresponsetime = 3000&lt;br/&gt;/ trialduration = 5000 &lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.memStims_art_A_y_T.elapsedtime]&lt;br/&gt;/ branch = [&lt;br/&gt;trial.mem_iti&lt;br/&gt;]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(3) this trial waits for a pretrial signal, i would like the elapsed time to reflect the time after the pretrialsignal is sent (it currently records time for the whole trial, including the time before the signal is detected).&lt;br/&gt;&amp;lt;trial new_memBlock&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = script.currenttime]&lt;br/&gt;/ stimulustimes = [0=blank,cross]&lt;br/&gt;/ trialduration = 6000&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ pretrialsignal = (keyboard,13)&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.new_memBlock.elapsedtime]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(4) is there a way to record elapsed time between trials?&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="34914"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;currenttime is not the timestamp I am referring to the trial's timestamp property.&lt;br/&gt;&lt;br/&gt;&lt;a href="https://www.millisecond.com/support/docs/v5/html/language/properties/timestamp.htm"&gt;&lt;a href="https://www.millisecond.com/support/docs/v5/html/language/properties/timestamp.htm"&gt;https://www.millisecond.com/support/docs/v5/html/language/properties/timestamp.htm&lt;/a&gt;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="34915"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;thank you, that certainly helps! &lt;br/&gt;&lt;br/&gt;one remaining question: is there any way to determine the exact timing of the start of the pretrial signal to the end of that trial (instead of also including the timing before the pretrial signal, example below)?&lt;br/&gt;&lt;br/&gt;&amp;lt;trial new_memBlock&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = trial.new_memBlock.timestamp]&lt;br/&gt;/ stimulustimes = [0=blank,cross]&lt;br/&gt;/ trialduration = 6000&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ pretrialsignal = (keyboard,13)&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.new_memBlock.elapsedtime]&lt;br/&gt;&amp;lt;/trial&amp;gt; &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="34917"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;So what the /pretrialsignal delays is mainly the start of the stimulus presentation sequence, i.e. what you have in /stimulustimes. You can get close to the time the pretrialsignal occured by looking at the timestamp property of the stimulus presented at t0 in the stimulus presentation sequence. Subtract the trial's timestamp from the "blank" stimulus's timestamp and you have the approximate time the trial object spent waiting for the pretrialsignal. &lt;br/&gt;&lt;br/&gt;If my goal were to get that trial to last as close to 6 seconds as possible, not considering time spent waiting for the pretrial signal, I would set it up along the following lines:&lt;br/&gt;&lt;br/&gt;[code]&amp;lt;values&amp;gt;&lt;br/&gt;/trialtimestamp = 0&lt;br/&gt;/trialelapsedtime = 0&lt;br/&gt;/1st_stimtimestamp = 0&lt;br/&gt;/waitperiodforpretrialsignal = 0&lt;br/&gt;&amp;lt;/values&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;block exampleblock&amp;gt;&lt;br/&gt;/ trials = [1-4 = trial.new_memBlock]&lt;br/&gt;&amp;lt;/block&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;trial new_memBlock&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = trial.new_memBlock.timestamp]&lt;br/&gt;/ stimulustimes = [0=blank,cross; 5980=clearscreen]&lt;br/&gt;/ posttrialpause = 20&lt;br/&gt;/ trialduration = 6000&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ pretrialsignal = (keyboard,13)&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.new_memBlock.elapsedtime;&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;values.1st_stimtimestamp = shape.blank.timestamp;&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;values.waitperiodforpretrialsignal = values.1st_stimtimestamp - values.trialtimestamp;]&lt;br/&gt;&amp;lt;/trial&amp;gt; &lt;br/&gt;&lt;br/&gt;&amp;lt;shape blank&amp;gt;&lt;br/&gt;/ shape = rectangle&lt;br/&gt;/ color = white&lt;br/&gt;/ size = (100%, 100%)&lt;br/&gt;/ erase = false&lt;br/&gt;&amp;lt;/shape&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;text cross&amp;gt;&lt;br/&gt;/ items = ("+")&lt;br/&gt;/ erase = false&lt;br/&gt;&amp;lt;/text&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;data&amp;gt;&lt;br/&gt;/ columns = (date time subject group blocknum blockcode trialnum trialcode response latency correct&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;values.trialtimestamp values.1st_stimtimestamp values.waitperiodforpretrialsignal)&lt;br/&gt;/ separatefiles = true&lt;br/&gt;&amp;lt;/data&amp;gt;[/code]&lt;br/&gt;&lt;br/&gt;When you look at the data, you should see approx. 6000 ms elapsing between values.1st_stimtimestamp in trial N and values.trialtimestamp in trial N+1.&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="34918"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;thank you so much, this really helps!!</description><pubDate>Tue, 08 Nov 2022 19:51:13 GMT</pubDate><dc:creator>nrouhani</dc:creator></item><item><title>RE: millisecond timing precision</title><link>https://forums.millisecond.com/Topic34918.aspx</link><description>&lt;blockquote data-id="34917" class="if-quote-wrapper" unselectable="on" data-guid="1667934270865" id="if_insertedNode_1667934269347" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34917" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34917" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34917" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;nrouhani - 11/8/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34917"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;&lt;blockquote data-id="34915" class="if-quote-wrapper" unselectable="on" data-guid="1667934270865" id="if_insertedNode_1667934001711" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34915" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34915" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34915" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Dave - 11/7/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34915"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;&lt;blockquote data-id="34914" class="if-quote-wrapper" unselectable="on" data-guid="1667934270865" id="if_insertedNode_1667836628230" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34914" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34914" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34914" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;nrouhani - 11/7/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34914"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;&lt;blockquote data-id="34912" class="if-quote-wrapper" unselectable="on" data-guid="1667934270865" id="if_insertedNode_1667835996091" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34912" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34912" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34912" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Dave - 11/7/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34912"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;&lt;blockquote data-id="34910" class="if-quote-wrapper" unselectable="on" data-guid="1667934270865" id="if_insertedNode_1667823721818" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34910" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34910" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34910" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;nrouhani - 11/5/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34910"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;hello,&amp;nbsp;&lt;br/&gt;&lt;br/&gt;i am running an fMRI study that needs very precise timing information. i understand that the timestamps don't have mililseconds, and i've tried to use a combination of timestamps at the beginning of each trial and elapsed time during each trial to get more precise timing information. i'm noticing that the numbers aren't adding up, the difference in timestamps from start to finish do not match the sum of trial's elapsed time (and for many trials the elapsed time is below the minimum trial duration). below, i have listed 4 specific examples of what elapsed time measures i would like to be able to record.&amp;nbsp;&lt;br/&gt;&lt;br/&gt;(1) how do i record elapsed time for the posttrialpause below? (i.e., would like elapsed time that reflects the below trial duration)&lt;br/&gt;&amp;lt;openended estimate_nat&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = script.currenttime]&lt;br/&gt;/ position = (50, 50)&lt;br/&gt;/ buttonlabel = "please enter estimate"&lt;br/&gt;/ fontstyle = ("Arial",20)&lt;br/&gt;/ inputdevice = keyboard&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ stimulustimes = [0=sceneStim_current, estimateQ, leftHand, rightHand]&lt;br/&gt;/ linelength = 3&lt;br/&gt;/ range = (0,100)&lt;br/&gt;/ mask = positiveintegerorzero&lt;br/&gt;/ numlines = 1&lt;br/&gt;/ responsefontstyle = ("Arial",80)&lt;br/&gt;/ posttrialpause = 2000&lt;br/&gt;/ trialduration = 5000&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.estimate_nat.elapsedtime]&lt;br/&gt;/ branch = [&lt;br/&gt;trial.outcome_nat&lt;br/&gt;]&lt;br/&gt;&lt;br/&gt;(2) relatedly, would it be possible to have elapsed timing information for the entire trial (reflecting trial duration) and not just after the response?  &lt;br/&gt;&amp;lt;trial memStims_art_A_y_T&amp;gt;&lt;br/&gt;/ ontrialbegin = [&lt;br/&gt;&amp;nbsp; values.artSample = list.memList_imageSelect_art_A_y.nextvalue;&lt;br/&gt;&amp;nbsp; values.trialtimestamp = script.currenttime;&lt;br/&gt;]&lt;br/&gt;/ stimulustimes = [0=blank, artP; 3000=newOld, memScale, mem_leftHand, mem_rightHand]&lt;br/&gt;/ validresponse = ("0","1","2","3","4","5","6","7","8","9")&lt;br/&gt;/ beginresponsetime = 3000&lt;br/&gt;/ trialduration = 5000&amp;nbsp; &lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.memStims_art_A_y_T.elapsedtime]&lt;br/&gt;/ branch = [&lt;br/&gt;trial.mem_iti&lt;br/&gt;]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(3) this trial waits for a pretrial signal, i would like the elapsed time to reflect the time after the pretrialsignal is sent (it currently records time for the whole trial, including the time before the signal is detected). &lt;br/&gt;&amp;lt;trial new_memBlock&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = script.currenttime]&lt;br/&gt;/ stimulustimes = [0=blank,cross]&lt;br/&gt;/ trialduration = 6000&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ pretrialsignal = (keyboard,13)&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.new_memBlock.elapsedtime]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(4) is there a way to record elapsed time between trials? &lt;br/&gt;&lt;br/&gt;thank you so much, i understand this is tedious!! &lt;a class="if-quote-goto quote-link" href="#" data-id="34910"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;/ontrialend logic is executed sometime during the posttrialpause, so taking elapsed time ontrialend it does not capture the duration of the posttrialpause and is not supposed to.&lt;br/&gt;&lt;br/&gt;The most accurate measurement you can get is taking a trial N's timestamp /ontrialbegin, taking trial N+1's timestamp /ontrialbegin, and then calculating the difference. The result is the overall duration of trial N, including any posttrialpause and time "between" trials.&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="34912"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;as i have included in my example, i do include a timestamp on each trial's /ontrialbegin, it is however not in milliseconds and not as accurate as i need it to be (the timestamp is also not lining up with outside time measures) - is this my only solution? &lt;br/&gt;&lt;br/&gt;i also included three other examples in my initial question about the 'elapsed time' measure that have gone unanswered (pasted below again) - i would appreciate your input on how to deal with them (especially when the elapsed time seems to stop after a response is recorded and not record the entire trial duration). thank you&lt;br/&gt;&lt;br/&gt;(2) relatedly, would it be possible to have elapsed timing information for the entire trial (reflecting trial duration) and not just after the response?&lt;br/&gt;&amp;lt;trial memStims_art_A_y_T&amp;gt;&lt;br/&gt;/ ontrialbegin = [&lt;br/&gt;  values.artSample = list.memList_imageSelect_art_A_y.nextvalue;&lt;br/&gt;  values.trialtimestamp = script.currenttime;&lt;br/&gt;]&lt;br/&gt;/ stimulustimes = [0=blank, artP; 3000=newOld, memScale, mem_leftHand, mem_rightHand]&lt;br/&gt;/ validresponse = ("0","1","2","3","4","5","6","7","8","9")&lt;br/&gt;/ beginresponsetime = 3000&lt;br/&gt;/ trialduration = 5000 &lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.memStims_art_A_y_T.elapsedtime]&lt;br/&gt;/ branch = [&lt;br/&gt;trial.mem_iti&lt;br/&gt;]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(3) this trial waits for a pretrial signal, i would like the elapsed time to reflect the time after the pretrialsignal is sent (it currently records time for the whole trial, including the time before the signal is detected).&lt;br/&gt;&amp;lt;trial new_memBlock&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = script.currenttime]&lt;br/&gt;/ stimulustimes = [0=blank,cross]&lt;br/&gt;/ trialduration = 6000&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ pretrialsignal = (keyboard,13)&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.new_memBlock.elapsedtime]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(4) is there a way to record elapsed time between trials?&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="34914"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;currenttime is not the timestamp I am referring to the trial's timestamp property.&lt;br/&gt;&lt;br/&gt;&lt;a href="https://www.millisecond.com/support/docs/v5/html/language/properties/timestamp.htm"&gt;&lt;a href="https://www.millisecond.com/support/docs/v5/html/language/properties/timestamp.htm"&gt;https://www.millisecond.com/support/docs/v5/html/language/properties/timestamp.htm&lt;/a&gt;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="34915"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;thank you, that certainly helps! &lt;br/&gt;&lt;br/&gt;one remaining question: is there any way to determine the exact timing of the start of the pretrial signal to the end of that trial (instead of also including the timing before the pretrial signal, example below)?&lt;br/&gt;&lt;br/&gt;&amp;lt;trial new_memBlock&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = trial.new_memBlock.timestamp]&lt;br/&gt;/ stimulustimes = [0=blank,cross]&lt;br/&gt;/ trialduration = 6000&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ pretrialsignal = (keyboard,13)&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.new_memBlock.elapsedtime]&lt;br/&gt;&amp;lt;/trial&amp;gt; &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="34917"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;So what the /pretrialsignal delays is mainly the start of the stimulus presentation sequence, i.e. what you have in /stimulustimes. You can get close to the time the pretrialsignal occured by looking at the timestamp property of the stimulus presented at t0 in the stimulus presentation sequence. Subtract the trial's timestamp from the "blank" stimulus's timestamp and you have the approximate time the trial object spent waiting for the pretrialsignal. &lt;br/&gt;&lt;br/&gt;If my goal were to get that trial to last as close to 6 seconds as possible, not considering time spent waiting for the pretrial signal, I would set it up along the following lines:&lt;br/&gt;&lt;br/&gt;[code]&amp;lt;values&amp;gt;&lt;br/&gt;/trialtimestamp = 0&lt;br/&gt;/trialelapsedtime = 0&lt;br/&gt;/1st_stimtimestamp = 0&lt;br/&gt;/waitperiodforpretrialsignal = 0&lt;br/&gt;&amp;lt;/values&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;block exampleblock&amp;gt;&lt;br/&gt;/ trials = [1-4 = trial.new_memBlock]&lt;br/&gt;&amp;lt;/block&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;trial new_memBlock&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = trial.new_memBlock.timestamp]&lt;br/&gt;/ stimulustimes = [0=blank,cross; 5980=clearscreen]&lt;br/&gt;/ posttrialpause = 20&lt;br/&gt;/ trialduration = 6000&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ pretrialsignal = (keyboard,13)&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.new_memBlock.elapsedtime;&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;values.1st_stimtimestamp = shape.blank.timestamp;&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;values.waitperiodforpretrialsignal = values.1st_stimtimestamp - values.trialtimestamp;]&lt;br/&gt;&amp;lt;/trial&amp;gt; &lt;br/&gt;&lt;br/&gt;&amp;lt;shape blank&amp;gt;&lt;br/&gt;/ shape = rectangle&lt;br/&gt;/ color = white&lt;br/&gt;/ size = (100%, 100%)&lt;br/&gt;/ erase = false&lt;br/&gt;&amp;lt;/shape&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;text cross&amp;gt;&lt;br/&gt;/ items = ("+")&lt;br/&gt;/ erase = false&lt;br/&gt;&amp;lt;/text&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;data&amp;gt;&lt;br/&gt;/ columns = (date time subject group blocknum blockcode trialnum trialcode response latency correct&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;values.trialtimestamp values.1st_stimtimestamp values.waitperiodforpretrialsignal)&lt;br/&gt;/ separatefiles = true&lt;br/&gt;&amp;lt;/data&amp;gt;[/code]&lt;br/&gt;&lt;br/&gt;When you look at the data, you should see approx. 6000 ms elapsing between values.1st_stimtimestamp in trial N and values.trialtimestamp in trial N+1.&lt;br/&gt;</description><pubDate>Tue, 08 Nov 2022 19:33:54 GMT</pubDate><dc:creator>Dave</dc:creator></item><item><title>RE: millisecond timing precision</title><link>https://forums.millisecond.com/Topic34917.aspx</link><description>&lt;blockquote data-id="34915" class="if-quote-wrapper" unselectable="on" data-guid="1667934002744" contenteditable="false" id="if_insertedNode_1667934001711"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34915" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34915" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34915" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Dave - 11/7/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34915"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;&lt;blockquote data-id="34914" class="if-quote-wrapper" unselectable="on" data-guid="1667934002744" id="if_insertedNode_1667836628230" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34914" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34914" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34914" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;nrouhani - 11/7/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34914"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;&lt;blockquote data-id="34912" class="if-quote-wrapper" unselectable="on" data-guid="1667934002744" id="if_insertedNode_1667835996091" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34912" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34912" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34912" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Dave - 11/7/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34912"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;&lt;blockquote data-id="34910" class="if-quote-wrapper" unselectable="on" data-guid="1667934002744" id="if_insertedNode_1667823721818" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34910" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34910" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34910" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;nrouhani - 11/5/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34910"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;hello,&amp;nbsp;&lt;br/&gt;&lt;br/&gt;i am running an fMRI study that needs very precise timing information. i understand that the timestamps don't have mililseconds, and i've tried to use a combination of timestamps at the beginning of each trial and elapsed time during each trial to get more precise timing information. i'm noticing that the numbers aren't adding up, the difference in timestamps from start to finish do not match the sum of trial's elapsed time (and for many trials the elapsed time is below the minimum trial duration). below, i have listed 4 specific examples of what elapsed time measures i would like to be able to record.&amp;nbsp;&lt;br/&gt;&lt;br/&gt;(1) how do i record elapsed time for the posttrialpause below? (i.e., would like elapsed time that reflects the below trial duration)&lt;br/&gt;&amp;lt;openended estimate_nat&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = script.currenttime]&lt;br/&gt;/ position = (50, 50)&lt;br/&gt;/ buttonlabel = "please enter estimate"&lt;br/&gt;/ fontstyle = ("Arial",20)&lt;br/&gt;/ inputdevice = keyboard&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ stimulustimes = [0=sceneStim_current, estimateQ, leftHand, rightHand]&lt;br/&gt;/ linelength = 3&lt;br/&gt;/ range = (0,100)&lt;br/&gt;/ mask = positiveintegerorzero&lt;br/&gt;/ numlines = 1&lt;br/&gt;/ responsefontstyle = ("Arial",80)&lt;br/&gt;/ posttrialpause = 2000&lt;br/&gt;/ trialduration = 5000&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.estimate_nat.elapsedtime]&lt;br/&gt;/ branch = [&lt;br/&gt;trial.outcome_nat&lt;br/&gt;]&lt;br/&gt;&lt;br/&gt;(2) relatedly, would it be possible to have elapsed timing information for the entire trial (reflecting trial duration) and not just after the response?  &lt;br/&gt;&amp;lt;trial memStims_art_A_y_T&amp;gt;&lt;br/&gt;/ ontrialbegin = [&lt;br/&gt;&amp;nbsp; values.artSample = list.memList_imageSelect_art_A_y.nextvalue;&lt;br/&gt;&amp;nbsp; values.trialtimestamp = script.currenttime;&lt;br/&gt;]&lt;br/&gt;/ stimulustimes = [0=blank, artP; 3000=newOld, memScale, mem_leftHand, mem_rightHand]&lt;br/&gt;/ validresponse = ("0","1","2","3","4","5","6","7","8","9")&lt;br/&gt;/ beginresponsetime = 3000&lt;br/&gt;/ trialduration = 5000&amp;nbsp; &lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.memStims_art_A_y_T.elapsedtime]&lt;br/&gt;/ branch = [&lt;br/&gt;trial.mem_iti&lt;br/&gt;]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(3) this trial waits for a pretrial signal, i would like the elapsed time to reflect the time after the pretrialsignal is sent (it currently records time for the whole trial, including the time before the signal is detected). &lt;br/&gt;&amp;lt;trial new_memBlock&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = script.currenttime]&lt;br/&gt;/ stimulustimes = [0=blank,cross]&lt;br/&gt;/ trialduration = 6000&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ pretrialsignal = (keyboard,13)&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.new_memBlock.elapsedtime]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(4) is there a way to record elapsed time between trials? &lt;br/&gt;&lt;br/&gt;thank you so much, i understand this is tedious!! &lt;a class="if-quote-goto quote-link" href="#" data-id="34910"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;/ontrialend logic is executed sometime during the posttrialpause, so taking elapsed time ontrialend it does not capture the duration of the posttrialpause and is not supposed to.&lt;br/&gt;&lt;br/&gt;The most accurate measurement you can get is taking a trial N's timestamp /ontrialbegin, taking trial N+1's timestamp /ontrialbegin, and then calculating the difference. The result is the overall duration of trial N, including any posttrialpause and time "between" trials.&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="34912"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;as i have included in my example, i do include a timestamp on each trial's /ontrialbegin, it is however not in milliseconds and not as accurate as i need it to be (the timestamp is also not lining up with outside time measures) - is this my only solution? &lt;br/&gt;&lt;br/&gt;i also included three other examples in my initial question about the 'elapsed time' measure that have gone unanswered (pasted below again) - i would appreciate your input on how to deal with them (especially when the elapsed time seems to stop after a response is recorded and not record the entire trial duration). thank you&lt;br/&gt;&lt;br/&gt;(2) relatedly, would it be possible to have elapsed timing information for the entire trial (reflecting trial duration) and not just after the response?&lt;br/&gt;&amp;lt;trial memStims_art_A_y_T&amp;gt;&lt;br/&gt;/ ontrialbegin = [&lt;br/&gt;  values.artSample = list.memList_imageSelect_art_A_y.nextvalue;&lt;br/&gt;  values.trialtimestamp = script.currenttime;&lt;br/&gt;]&lt;br/&gt;/ stimulustimes = [0=blank, artP; 3000=newOld, memScale, mem_leftHand, mem_rightHand]&lt;br/&gt;/ validresponse = ("0","1","2","3","4","5","6","7","8","9")&lt;br/&gt;/ beginresponsetime = 3000&lt;br/&gt;/ trialduration = 5000 &lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.memStims_art_A_y_T.elapsedtime]&lt;br/&gt;/ branch = [&lt;br/&gt;trial.mem_iti&lt;br/&gt;]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(3) this trial waits for a pretrial signal, i would like the elapsed time to reflect the time after the pretrialsignal is sent (it currently records time for the whole trial, including the time before the signal is detected).&lt;br/&gt;&amp;lt;trial new_memBlock&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = script.currenttime]&lt;br/&gt;/ stimulustimes = [0=blank,cross]&lt;br/&gt;/ trialduration = 6000&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ pretrialsignal = (keyboard,13)&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.new_memBlock.elapsedtime]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(4) is there a way to record elapsed time between trials?&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="34914"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;currenttime is not the timestamp I am referring to the trial's timestamp property.&lt;br/&gt;&lt;br/&gt;&lt;a href="https://www.millisecond.com/support/docs/v5/html/language/properties/timestamp.htm"&gt;&lt;a href="https://www.millisecond.com/support/docs/v5/html/language/properties/timestamp.htm"&gt;https://www.millisecond.com/support/docs/v5/html/language/properties/timestamp.htm&lt;/a&gt;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="34915"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;thank you, that certainly helps! &lt;br/&gt;&lt;br/&gt;one remaining question: is there any way to determine the exact timing of the start of the pretrial signal to the end of that trial (instead of also including the timing before the pretrial signal, example below)?&lt;br/&gt;&lt;br/&gt;&amp;lt;trial new_memBlock&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = trial.new_memBlock.timestamp]&lt;br/&gt;/ stimulustimes = [0=blank,cross]&lt;br/&gt;/ trialduration = 6000&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ pretrialsignal = (keyboard,13)&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.new_memBlock.elapsedtime]&lt;br/&gt;&amp;lt;/trial&amp;gt; &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;</description><pubDate>Tue, 08 Nov 2022 19:02:04 GMT</pubDate><dc:creator>nrouhani</dc:creator></item><item><title>RE: millisecond timing precision</title><link>https://forums.millisecond.com/Topic34915.aspx</link><description>&lt;blockquote data-id="34914" class="if-quote-wrapper" unselectable="on" data-guid="1667836629817" id="if_insertedNode_1667836628230" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34914" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34914" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34914" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;nrouhani - 11/7/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34914"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;&lt;blockquote data-id="34912" class="if-quote-wrapper" unselectable="on" data-guid="1667836629817" id="if_insertedNode_1667835996091" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34912" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34912" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34912" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Dave - 11/7/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34912"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;&lt;blockquote data-id="34910" class="if-quote-wrapper" unselectable="on" data-guid="1667836629817" id="if_insertedNode_1667823721818" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34910" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34910" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34910" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;nrouhani - 11/5/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34910"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;hello,&amp;nbsp;&lt;br/&gt;&lt;br/&gt;i am running an fMRI study that needs very precise timing information. i understand that the timestamps don't have mililseconds, and i've tried to use a combination of timestamps at the beginning of each trial and elapsed time during each trial to get more precise timing information. i'm noticing that the numbers aren't adding up, the difference in timestamps from start to finish do not match the sum of trial's elapsed time (and for many trials the elapsed time is below the minimum trial duration). below, i have listed 4 specific examples of what elapsed time measures i would like to be able to record.&amp;nbsp;&lt;br/&gt;&lt;br/&gt;(1) how do i record elapsed time for the posttrialpause below? (i.e., would like elapsed time that reflects the below trial duration)&lt;br/&gt;&amp;lt;openended estimate_nat&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = script.currenttime]&lt;br/&gt;/ position = (50, 50)&lt;br/&gt;/ buttonlabel = "please enter estimate"&lt;br/&gt;/ fontstyle = ("Arial",20)&lt;br/&gt;/ inputdevice = keyboard&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ stimulustimes = [0=sceneStim_current, estimateQ, leftHand, rightHand]&lt;br/&gt;/ linelength = 3&lt;br/&gt;/ range = (0,100)&lt;br/&gt;/ mask = positiveintegerorzero&lt;br/&gt;/ numlines = 1&lt;br/&gt;/ responsefontstyle = ("Arial",80)&lt;br/&gt;/ posttrialpause = 2000&lt;br/&gt;/ trialduration = 5000&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.estimate_nat.elapsedtime]&lt;br/&gt;/ branch = [&lt;br/&gt;trial.outcome_nat&lt;br/&gt;]&lt;br/&gt;&lt;br/&gt;(2) relatedly, would it be possible to have elapsed timing information for the entire trial (reflecting trial duration) and not just after the response?  &lt;br/&gt;&amp;lt;trial memStims_art_A_y_T&amp;gt;&lt;br/&gt;/ ontrialbegin = [&lt;br/&gt;&amp;nbsp; values.artSample = list.memList_imageSelect_art_A_y.nextvalue;&lt;br/&gt;&amp;nbsp; values.trialtimestamp = script.currenttime;&lt;br/&gt;]&lt;br/&gt;/ stimulustimes = [0=blank, artP; 3000=newOld, memScale, mem_leftHand, mem_rightHand]&lt;br/&gt;/ validresponse = ("0","1","2","3","4","5","6","7","8","9")&lt;br/&gt;/ beginresponsetime = 3000&lt;br/&gt;/ trialduration = 5000&amp;nbsp; &lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.memStims_art_A_y_T.elapsedtime]&lt;br/&gt;/ branch = [&lt;br/&gt;trial.mem_iti&lt;br/&gt;]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(3) this trial waits for a pretrial signal, i would like the elapsed time to reflect the time after the pretrialsignal is sent (it currently records time for the whole trial, including the time before the signal is detected). &lt;br/&gt;&amp;lt;trial new_memBlock&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = script.currenttime]&lt;br/&gt;/ stimulustimes = [0=blank,cross]&lt;br/&gt;/ trialduration = 6000&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ pretrialsignal = (keyboard,13)&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.new_memBlock.elapsedtime]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(4) is there a way to record elapsed time between trials? &lt;br/&gt;&lt;br/&gt;thank you so much, i understand this is tedious!! &lt;a class="if-quote-goto quote-link" href="#" data-id="34910"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;/ontrialend logic is executed sometime during the posttrialpause, so taking elapsed time ontrialend it does not capture the duration of the posttrialpause and is not supposed to.&lt;br/&gt;&lt;br/&gt;The most accurate measurement you can get is taking a trial N's timestamp /ontrialbegin, taking trial N+1's timestamp /ontrialbegin, and then calculating the difference. The result is the overall duration of trial N, including any posttrialpause and time "between" trials.&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="34912"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;as i have included in my example, i do include a timestamp on each trial's /ontrialbegin, it is however not in milliseconds and not as accurate as i need it to be (the timestamp is also not lining up with outside time measures) - is this my only solution? &lt;br/&gt;&lt;br/&gt;i also included three other examples in my initial question about the 'elapsed time' measure that have gone unanswered (pasted below again) - i would appreciate your input on how to deal with them (especially when the elapsed time seems to stop after a response is recorded and not record the entire trial duration). thank you&lt;br/&gt;&lt;br/&gt;(2) relatedly, would it be possible to have elapsed timing information for the entire trial (reflecting trial duration) and not just after the response?&lt;br/&gt;&amp;lt;trial memStims_art_A_y_T&amp;gt;&lt;br/&gt;/ ontrialbegin = [&lt;br/&gt;  values.artSample = list.memList_imageSelect_art_A_y.nextvalue;&lt;br/&gt;  values.trialtimestamp = script.currenttime;&lt;br/&gt;]&lt;br/&gt;/ stimulustimes = [0=blank, artP; 3000=newOld, memScale, mem_leftHand, mem_rightHand]&lt;br/&gt;/ validresponse = ("0","1","2","3","4","5","6","7","8","9")&lt;br/&gt;/ beginresponsetime = 3000&lt;br/&gt;/ trialduration = 5000 &lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.memStims_art_A_y_T.elapsedtime]&lt;br/&gt;/ branch = [&lt;br/&gt;trial.mem_iti&lt;br/&gt;]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(3) this trial waits for a pretrial signal, i would like the elapsed time to reflect the time after the pretrialsignal is sent (it currently records time for the whole trial, including the time before the signal is detected).&lt;br/&gt;&amp;lt;trial new_memBlock&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = script.currenttime]&lt;br/&gt;/ stimulustimes = [0=blank,cross]&lt;br/&gt;/ trialduration = 6000&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ pretrialsignal = (keyboard,13)&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.new_memBlock.elapsedtime]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(4) is there a way to record elapsed time between trials?&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="34914"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;currenttime is not the timestamp I am referring to the trial's timestamp property.&lt;br/&gt;&lt;br/&gt;&lt;a href="https://www.millisecond.com/support/docs/v5/html/language/properties/timestamp.htm"&gt;https://www.millisecond.com/support/docs/v5/html/language/properties/timestamp.htm&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;</description><pubDate>Mon, 07 Nov 2022 15:58:15 GMT</pubDate><dc:creator>Dave</dc:creator></item><item><title>RE: millisecond timing precision</title><link>https://forums.millisecond.com/Topic34914.aspx</link><description>&lt;blockquote data-id="34912" class="if-quote-wrapper" unselectable="on" data-guid="1667835997200" contenteditable="false" id="if_insertedNode_1667835996091"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34912" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34912" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34912" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Dave - 11/7/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34912"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;&lt;blockquote data-id="34910" class="if-quote-wrapper" unselectable="on" data-guid="1667835997200" id="if_insertedNode_1667823721818" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34910" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34910" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34910" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;nrouhani - 11/5/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34910"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;hello,&amp;nbsp;&lt;br/&gt;&lt;br/&gt;i am running an fMRI study that needs very precise timing information. i understand that the timestamps don't have mililseconds, and i've tried to use a combination of timestamps at the beginning of each trial and elapsed time during each trial to get more precise timing information. i'm noticing that the numbers aren't adding up, the difference in timestamps from start to finish do not match the sum of trial's elapsed time (and for many trials the elapsed time is below the minimum trial duration). below, i have listed 4 specific examples of what elapsed time measures i would like to be able to record.&amp;nbsp;&lt;br/&gt;&lt;br/&gt;(1) how do i record elapsed time for the posttrialpause below? (i.e., would like elapsed time that reflects the below trial duration)&lt;br/&gt;&amp;lt;openended estimate_nat&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = script.currenttime]&lt;br/&gt;/ position = (50, 50)&lt;br/&gt;/ buttonlabel = "please enter estimate"&lt;br/&gt;/ fontstyle = ("Arial",20)&lt;br/&gt;/ inputdevice = keyboard&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ stimulustimes = [0=sceneStim_current, estimateQ, leftHand, rightHand]&lt;br/&gt;/ linelength = 3&lt;br/&gt;/ range = (0,100)&lt;br/&gt;/ mask = positiveintegerorzero&lt;br/&gt;/ numlines = 1&lt;br/&gt;/ responsefontstyle = ("Arial",80)&lt;br/&gt;/ posttrialpause = 2000&lt;br/&gt;/ trialduration = 5000&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.estimate_nat.elapsedtime]&lt;br/&gt;/ branch = [&lt;br/&gt;trial.outcome_nat&lt;br/&gt;]&lt;br/&gt;&lt;br/&gt;(2) relatedly, would it be possible to have elapsed timing information for the entire trial (reflecting trial duration) and not just after the response?  &lt;br/&gt;&amp;lt;trial memStims_art_A_y_T&amp;gt;&lt;br/&gt;/ ontrialbegin = [&lt;br/&gt;&amp;nbsp; values.artSample = list.memList_imageSelect_art_A_y.nextvalue;&lt;br/&gt;&amp;nbsp; values.trialtimestamp = script.currenttime;&lt;br/&gt;]&lt;br/&gt;/ stimulustimes = [0=blank, artP; 3000=newOld, memScale, mem_leftHand, mem_rightHand]&lt;br/&gt;/ validresponse = ("0","1","2","3","4","5","6","7","8","9")&lt;br/&gt;/ beginresponsetime = 3000&lt;br/&gt;/ trialduration = 5000&amp;nbsp; &lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.memStims_art_A_y_T.elapsedtime]&lt;br/&gt;/ branch = [&lt;br/&gt;trial.mem_iti&lt;br/&gt;]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(3) this trial waits for a pretrial signal, i would like the elapsed time to reflect the time after the pretrialsignal is sent (it currently records time for the whole trial, including the time before the signal is detected). &lt;br/&gt;&amp;lt;trial new_memBlock&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = script.currenttime]&lt;br/&gt;/ stimulustimes = [0=blank,cross]&lt;br/&gt;/ trialduration = 6000&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ pretrialsignal = (keyboard,13)&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.new_memBlock.elapsedtime]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(4) is there a way to record elapsed time between trials? &lt;br/&gt;&lt;br/&gt;thank you so much, i understand this is tedious!! &lt;a class="if-quote-goto quote-link" href="#" data-id="34910"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;/ontrialend logic is executed sometime during the posttrialpause, so taking elapsed time ontrialend it does not capture the duration of the posttrialpause and is not supposed to.&lt;br/&gt;&lt;br/&gt;The most accurate measurement you can get is taking a trial N's timestamp /ontrialbegin, taking trial N+1's timestamp /ontrialbegin, and then calculating the difference. The result is the overall duration of trial N, including any posttrialpause and time "between" trials.&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="34912"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;as i have included in my example, i do include a timestamp on each trial's /ontrialbegin, it is however not in milliseconds and not as accurate as i need it to be (the timestamp is also not lining up with outside time measures) - is this my only solution? &lt;br/&gt;&lt;br/&gt;i also included three other examples in my initial question about the 'elapsed time' measure that have gone unanswered (pasted below again) - i would appreciate your input on how to deal with them (especially when the elapsed time seems to stop after a response is recorded and not record the entire trial duration). thank you&lt;br/&gt;&lt;br/&gt;(2) relatedly, would it be possible to have elapsed timing information for the entire trial (reflecting trial duration) and not just after the response?&lt;br/&gt;&amp;lt;trial memStims_art_A_y_T&amp;gt;&lt;br/&gt;/ ontrialbegin = [&lt;br/&gt;  values.artSample = list.memList_imageSelect_art_A_y.nextvalue;&lt;br/&gt;  values.trialtimestamp = script.currenttime;&lt;br/&gt;]&lt;br/&gt;/ stimulustimes = [0=blank, artP; 3000=newOld, memScale, mem_leftHand, mem_rightHand]&lt;br/&gt;/ validresponse = ("0","1","2","3","4","5","6","7","8","9")&lt;br/&gt;/ beginresponsetime = 3000&lt;br/&gt;/ trialduration = 5000 &lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.memStims_art_A_y_T.elapsedtime]&lt;br/&gt;/ branch = [&lt;br/&gt;trial.mem_iti&lt;br/&gt;]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(3) this trial waits for a pretrial signal, i would like the elapsed time to reflect the time after the pretrialsignal is sent (it currently records time for the whole trial, including the time before the signal is detected).&lt;br/&gt;&amp;lt;trial new_memBlock&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = script.currenttime]&lt;br/&gt;/ stimulustimes = [0=blank,cross]&lt;br/&gt;/ trialduration = 6000&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ pretrialsignal = (keyboard,13)&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.new_memBlock.elapsedtime]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(4) is there a way to record elapsed time between trials?&lt;br/&gt;</description><pubDate>Mon, 07 Nov 2022 15:51:12 GMT</pubDate><dc:creator>nrouhani</dc:creator></item><item><title>RE: millisecond timing precision</title><link>https://forums.millisecond.com/Topic34912.aspx</link><description>&lt;blockquote data-id="34910" class="if-quote-wrapper" unselectable="on" data-guid="1667823723743" id="if_insertedNode_1667823721818" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="34910" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="34910" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="34910" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;nrouhani - 11/5/2022&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-34910"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;hello,&amp;nbsp;&lt;br/&gt;&lt;br/&gt;i am running an fMRI study that needs very precise timing information. i understand that the timestamps don't have mililseconds, and i've tried to use a combination of timestamps at the beginning of each trial and elapsed time during each trial to get more precise timing information. i'm noticing that the numbers aren't adding up, the difference in timestamps from start to finish do not match the sum of trial's elapsed time (and for many trials the elapsed time is below the minimum trial duration). below, i have listed 4 specific examples of what elapsed time measures i would like to be able to record.&amp;nbsp;&lt;br/&gt;&lt;br/&gt;(1) how do i record elapsed time for the posttrialpause below? (i.e., would like elapsed time that reflects the below trial duration)&lt;br/&gt;&amp;lt;openended estimate_nat&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = script.currenttime]&lt;br/&gt;/ position = (50, 50)&lt;br/&gt;/ buttonlabel = "please enter estimate"&lt;br/&gt;/ fontstyle = ("Arial",20)&lt;br/&gt;/ inputdevice = keyboard&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ stimulustimes = [0=sceneStim_current, estimateQ, leftHand, rightHand]&lt;br/&gt;/ linelength = 3&lt;br/&gt;/ range = (0,100)&lt;br/&gt;/ mask = positiveintegerorzero&lt;br/&gt;/ numlines = 1&lt;br/&gt;/ responsefontstyle = ("Arial",80)&lt;br/&gt;/ posttrialpause = 2000&lt;br/&gt;/ trialduration = 5000&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.estimate_nat.elapsedtime]&lt;br/&gt;/ branch = [&lt;br/&gt;trial.outcome_nat&lt;br/&gt;]&lt;br/&gt;&lt;br/&gt;(2) relatedly, would it be possible to have elapsed timing information for the entire trial (reflecting trial duration) and not just after the response?  &lt;br/&gt;&amp;lt;trial memStims_art_A_y_T&amp;gt;&lt;br/&gt;/ ontrialbegin = [&lt;br/&gt;&amp;nbsp; values.artSample = list.memList_imageSelect_art_A_y.nextvalue;&lt;br/&gt;&amp;nbsp; values.trialtimestamp = script.currenttime;&lt;br/&gt;]&lt;br/&gt;/ stimulustimes = [0=blank, artP; 3000=newOld, memScale, mem_leftHand, mem_rightHand]&lt;br/&gt;/ validresponse = ("0","1","2","3","4","5","6","7","8","9")&lt;br/&gt;/ beginresponsetime = 3000&lt;br/&gt;/ trialduration = 5000&amp;nbsp; &lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.memStims_art_A_y_T.elapsedtime]&lt;br/&gt;/ branch = [&lt;br/&gt;trial.mem_iti&lt;br/&gt;]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(3) this trial waits for a pretrial signal, i would like the elapsed time to reflect the time after the pretrialsignal is sent (it currently records time for the whole trial, including the time before the signal is detected). &lt;br/&gt;&amp;lt;trial new_memBlock&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.trialtimestamp = script.currenttime]&lt;br/&gt;/ stimulustimes = [0=blank,cross]&lt;br/&gt;/ trialduration = 6000&lt;br/&gt;/ validresponse = (noresponse)&lt;br/&gt;/ pretrialsignal = (keyboard,13)&lt;br/&gt;/ ontrialend = [values.trialelapsedtime = trial.new_memBlock.elapsedtime]&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;(4) is there a way to record elapsed time between trials? &lt;br/&gt;&lt;br/&gt;thank you so much, i understand this is tedious!! &lt;a class="if-quote-goto quote-link" href="#" data-id="34910"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;/ontrialend logic is executed sometime during the posttrialpause, so taking elapsed time ontrialend it does not capture the duration of the posttrialpause and is not supposed to.&lt;br/&gt;&lt;br/&gt;The most accurate measurement you can get is taking a trial N's timestamp /ontrialbegin, taking trial N+1's timestamp /ontrialbegin, and then calculating the difference. The result is the overall duration of trial N, including any posttrialpause and time "between" trials.&lt;br/&gt;</description><pubDate>Mon, 07 Nov 2022 12:25:01 GMT</pubDate><dc:creator>Dave</dc:creator></item></channel></rss>