Got bored and took it a couple steps further. Ignore the first post.


Installation
  • Press ALT+R to open remote.
  • Paste in the code and press OK.
  • Use "/timestampfix" command.
    This command can also be used to fix any sync or whatever issues.


Uninnstallation
  • Remove the code.
  • Use "/timertimestamp off" command.
  • Use "/timestamp -f HH:nn:ss" command to restore normal timestamp format.



If you switch between scripts, remember to use the /timestampfix command.


Simplest script with the best performance. If you want nothing fancy, this is it.

To change the timestamp format, you need to edit the ".timertimestamp..." line, specifically the part after "-f".

Examples:

.timertimestamp -om 0 0 .timestamp -f HH:nn:ss. $!+ $!right($calc($ticks - $+ $calc($ticks % 1000) $+ ),3)
Would result in: 12:34:56.789

.timertimestamp -om 0 0 .timestamp -f yyyy-mm-dd HH:nn:ss. $!+ $!right($calc($ticks - $+ $calc($ticks % 1000) $+ ),3)
Would result in: 2020-07-07 12:34:56.789

.timertimestamp -om 0 0 .timestamp -f [HH:nn:ss. $!+ $!right($calc($ticks - $+ $calc($ticks % 1000) $+ ),3) $!+ ]
Would result in: [12:34:56.789]

After you've changed the timer command, use "/timestampfix" command.
Code
on *:start:timestampfix

alias timestampfix {
  tokenize 1 $ctime
  while ($1 == $ctime) noop
  .timertimestamp -om 0 0 .timestamp -f HH:nn:ss. $!+ $!right($calc($ticks - $+ $calc($ticks % 1000) $+ ),3)
}




Fancy advanced version with a little performance impact. THIS VERSION CAN BREAK OTHER SCRIPTS, if echo alias is used.

Code
/*
timestampformat alias is the only part of the script you might
need to modify, specifically the part after the word "return".

Examples:
HH:nn:ss. $+ $timems
$+([HH:nn:ss.,$timems,])
yyyy-mm-dd HH:nn:ss. $+ $timems

/help $asctime
/help $+
*/
alias timestampformat return HH:nn:ss. $+ $timems

/*
echo alias is optional. It is only needed if you want the millisecond
timestamp to update in the middle of other scripts that use echo, but:
THIS CAN POTENTIALLY BREAK OTHER SCRIPTS.

To see the difference, use the following command with and without the echo alias.
//set -l %x 100 | while (%x) { echo -t <-- | dec %x }
*/
alias echo {
  if (-*t* iswmcs $1) {
    set -l %t $asctime($timestampformat)
    !echo $iif($removecs($1,t) != -,$v1) $iif($window($2),$2 %t $3-,%t $2-)
  }
  else !echo $1-
}

alias timems return $right($calc($ticks -%ticksoffset),3)

on *:start:timestampfix

alias timestampfix {
  set -l %c $ctime + 1
  while (%c > $ctime) noop
  set -e %ticksoffset $ticks % 1000
  .timertimestamp -om 0 0 .timestamp -f $!timestampformat
}




Mostly same as above, but with potentially increased precision from 16 ms to 1 ms. Slightly worse performance. THIS VERSION CAN BREAK OTHER SCRIPTS, if echo alias is used.

This version requires a custom time.dll in mIRC folder (//run $mircdir) to function.

The increased precision only applies to /echo commands, there is no reasonable to way to increase the precision of the other part of the script. You could potentially get a tiny bit more precision out of it by changing ".timertimestamp -om" into ".timertimestamp -oh", but it is not recommended.
Code
/*
timestampformat alias is the only part of the script you might
need to modify, specifically the part after the word "return".

Examples:
HH:nn:ss. $+ $timems
$+([HH:nn:ss.,$timems,])
yyyy-mm-dd HH:nn:ss. $+ $timems

/help $asctime
/help $+
*/
alias timestampformat return HH:nn:ss. $+ $timems

/*
echo alias is optional. It is only needed if you want the millisecond
timestamp to update in the middle of other scripts that use echo, but:
THIS CAN POTENTIALLY BREAK OTHER SCRIPTS.

To see the difference, use the following command with and without the echo alias.
//set -l %x 100 | while (%x) { echo -t <-- | dec %x }
*/
alias echo {
  if (-*t* iswmcs $1) {
    set -l %t $asctime($timestampformat)
    !echo $iif($removecs($1,t) != -,$v1) $iif($window($2),$2 %t $3-,%t $2-)
  }
  else !echo $1-
}

alias timems return $right($calc($dll(time.dll,ticks,0)-%ticksoffset),3)

on *:start:timestampfix

alias timestampfix {
  set -l %c $ctime + 1
  while (%c > $ctime) noop
  set -e %ticksoffset $dll(time.dll,ticks,0) % 1000
  .timertimestamp -om 0 0 .timestamp -f $!timestampformat
}


Last edited by Dazuz; 08/07/20 01:48 PM. Reason: made the whole post more coherent.