Jump to content
Macro Express Forums

Time


Jameka

Recommended Posts

Can you simply retrieve the time to the millisecond and store it in T1, retrieve a second time to the millisecond and store it in T2, and then simply subtract the two and write the difference in a file?

 

Or Must I retrieve each time and convert them to integers and then do the subtraction?

 

Thanks,

JMC

Link to comment
Share on other sites

Here are my 2 timer lines; first at time1, 2nd at time2

(run in macro; the macro can be derived from "DateTimeDifferences" macro

Randall

PS Don't run this or DateDiffences as playable; import them to your library and run and examine)

// path Registry Name as env var; %Reg%

Variable Set String %T1% "HKEY_CURRENT_USER\Software\Professional Grade Macros\PGM Functions\Swap\"

Variable Modify String: Save %T1% to Environment Variable

Text Box Display: Time 1 set

// Put this in first time spot in macro (not the display)

Variable Set String %T31% "<REM2:StartTime Set1

Run Macro in Variable %T31%

Text Box Display: Time 2

// Put this in 2nd time spot in macro (not the display)

Variable Set String %T31% "<REM2:StartTime Set3

Run Macro in Variable %T31%

// Displays results in D6

Text Box Display: Results

<REM2:path Registry Name as env var; %Reg%><TVAR2:01:01:HKEY_CURRENT_USER\Software\Professional Grade Macros\PGM Functions\Swap\><TMVAR2:19:01:00:000:000:Reg><TBOX4:T:4:000484000432000180000150:000:Time 1 setHit key when ready Ready?><REM2:Put this in first time spot in macro (not the display)><TVAR2:31:01:<TVAR2:01:01:HKEY_CURRENT_USER\\Software\\Professional Grade Macros\\PGM Functions\\Swap\\\s><TMVAR2:19:01:00:000:000:Reg><REM2:StartTime Set1\s><IVAR2:89:21:><DMVAR:03:86:1:000000000000188.0000:2:60><IVAR2:88:22:><DT:zzz\sT:79:1:><TMVAR2:06:79:79:000:000:><DMVAR:04:79:1:000000000000079.0000:2:1000><DMVAR:01:88:1:000000000000079.0000:1:000000000000187.0000><DMVAR:01:26:1:000000000000086.0000:1:000000000000088.0000><IVAR2:31:01:1><REGWINT:31:\x25Reg\x25TimerNumber><REGWDEC:26:\x25Reg\x25SecondsNumber(\x25N31\x25)><DMVAR:05:26:1:000000000000020.0000:1:000000000000003.0000><TMVAR2:19:20:00:000:000:SecondsNumber(\x2531\x25)><REM2:End Time Set1\s><REM2:StartTime Set2\s><IVAR2:89:21:><DMVAR:03:86:1:000000000000188.0000:2:60><IVAR2:88:22:><DT:zzz\sT:79:1:><TMVAR2:06:79:79:000:000:><DMVAR:04:79:1:000000000000079.0000:2:1000><DMVAR:01:88:1:000000000000079.0000:1:000000000000187.0000><DMVAR:01:26:1:000000000000086.0000:1:000000000000088.0000><IVAR2:31:01:2><REGWINT:31:\x25Reg\x25TimerNumber><REGWDEC:26:\x25Reg\x25SecondsNumber(\x25N31\x25)><DMVAR:05:26:1:000000000000020.0000:1:000000000000003.0000><TMVAR2:19:20:00:000:000:SecondsNumber(\x2531\x25)><REM2:End Time Set2\s>><RUNMACVAR:31><TBOX4:T:4:000334000371000223000187:000:Time 2Hit key when ready - Ready?><REM2:Put this in 2nd time spot in macro (not the display)><TVAR2:31:01:<TVAR2:01:01:HKEY_CURRENT_USER\\Software\\Professional Grade Macros\\PGM Functions\\Swap\\\s><TMVAR2:19:01:00:000:000:Reg><REM2:StartTime Set3\s><IVAR2:89:21:><DMVAR:03:86:1:000000000000188.0000:2:60><IVAR2:88:22:><DT:zzz\sT:79:1:><TMVAR2:06:79:79:000:000:><DMVAR:04:79:1:000000000000079.0000:2:1000><DMVAR:01:88:1:000000000000079.0000:1:000000000000187.0000><DMVAR:01:26:1:000000000000086.0000:1:000000000000088.0000><IVAR2:31:01:3><REGWINT:31:\x25Reg\x25TimerNumber><REGWDEC:26:\x25Reg\x25SecondsNumber(\x25N31\x25)><DMVAR:05:26:1:000000000000020.0000:1:000000000000003.0000><TMVAR2:19:20:00:000:000:SecondsNumber(\x2531\x25)><REM2:End Time Set 3\s><REGRSTR:3:\x25Reg\x25SortedTemp(StringSort)><REGRSTR:10:\x25Reg\x25ArrayString><REGRSTR:11:\x25Reg\x25timeecho><TMVAR2:21:10:01:000:000:&VBCRLF&\s\x25T23\x25\s><REGRDEC:1:\x25Reg\x25SecondsNumber(1)><REGRDEC:2:\x25Reg\x25SecondsNumber(2)><DMVAR:02:04:1:000000000000002.0000:1:000000000000001.0000><REGRDEC:3:\x25Reg\x25SecondsNumber(3)><DMVAR:02:05:1:000000000000003.0000:1:000000000000002.0000><DMVAR:01:06:1:000000000000004.0000:1:000000000000005.0000><ROUND:6:4>><RUNMACVAR:31><REM2:Displays results in D6><TBOX4:T:4:000074000310000866000272:000:Results = = = = = = = = = = = =

 

= = = = = = = = = = = =

 

TIME in ME TOTAL   = %D6% secs  %D1%Start

        %D3%End

>

(PS I realise now that my timer macro was more complicated, and did not use "Date Differences" macro; I must update it!)

2. You may need to use "Variable Save and restore before and after each of the liner timers; if you are worried about \\T10,23,31,20,79 N88,89,\\ D1,2,3,4,5,6,26, 79, 86, 88,\\N31,88,79,89 and retrieve %D6% fromthe following; the seconds numbers are stored in the registry

<REGRDEC:1:%Reg%SecondsNumber(1)><REGRDEC:2:%Reg%SecondsNumber(2)><DMVAR:02:04:1:000000000000002.0000:1:000000000000001.0000><REGRDEC:3:%Reg%SecondsNumber(3)><DMVAR:02:05:1:000000000000003.0000:1:000000000000002.0000><DMVAR:01:06:1:000000000000004.0000:1:000000000000005.0000><ROUND:6:4>

Timer_Lines.mxe

Edited by randallc
Link to comment
Share on other sites

This is the other option; using DateTimeDifferencesInput ; modified for download;

Just set time one (%T2%) (sorry)

  // Set Original Date/Time

  Date/Time: Save "yyyymmddhhmmsszzz" into %T2%

<REM2:Set Original Date/Time><DT:yyyymmddhhmmsszzzT:02:1:>

Then time 2(%T1%) , and run the macro (after imported to your library and named.

  // Set Current Date/Time

  Date/Time: Save "yyyymmddhhmmsszzz" into %T1%

  Macro Run: DateTimeDifferencesInput

<REM2:Set Current Date/Time><DT:yyyymmddhhmmsszzzT:01:1:><MACRUN2:DateTimeDifferencesInput>

DateTimeDifferencesInput will run standalone and request you to give times 1 and 2 if it finds T1 or T2 do not contain this month''s date in correct format;

Best, Randall

(It is easier to modify this to "black box-like function" by only setting , say D4 (currently set at end of macro) for the answer from the clipboard (or environment variable "AnswerSeconds") after returning from the macro if you wish) Let me know if problems (Date Differences was not working from site download recently, for unknown reasons; now OK?)

EDIT1 - Corrected to give negative result in env variable "CompletedDays" depending on order; re-loaded

DateTimeDifferencesInput.mxe

Edited by randallc
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...