Timestamp Serializer

Discuss and share scripts and script files...
Post Reply
bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Timestamp Serializer

Post by bdeshi »

A simple script that serializes timestamps of selected items, based on the timestamp of the first item.
Nothing fancy. I needed to make some files' creation dates 1 second apart, so I can keep them together when sorted by that field.

There are two choices on start:
shift amount - time difference between subsequent items' timestamps.
times to serialize - select which timestamp fields are to be serialized.

Code: Select all

"Timestamp Serializer"
 $shift = input('Timestamp shift amount'.<crlf>.'[-+]<amount> <y|m|w|d|h|n|s|ms|us>', 'eg. +1 s, -5 d, 2500 ms etc', '+1 s',,, 350);
 $stamp = inputselect('times to serialize'.<crlf>.'[shift: '.$shift.']', "creation time<crlf>modification time<crlf>access time", "<crlf>", 2,, 350, 210, 'Timestamp Serializer'); 

 $stamp = regexreplace($stamp, '^([^\r\n]).*[\r\n]*', '$1','');
 $items = <selitems |>;
 $count = gettoken($items, 'count', '|');
 $c = 1;
 while ($c < $count) {
   timestamp $stamp, gettoken($items, $c, '|'), gettoken($items, $c+1, '|'),, $shift;
   $c++;
 }
Note: the script has typos: "serialze"/"Serialzer" instead of "serialize"/"Serializer". Not important enough (doesn't affect code at all) for reupload
Attachments
TimestampSerializer.xys
(606 Bytes) Downloaded 105 times
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Post Reply