-
-
Save PetarKirov/090e7fb9c2a919203065bf91f327a949 to your computer and use it in GitHub Desktop.
Relative timestamp filter program in D
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() | |
{ | |
import core.time : MonoTime; | |
import std.stdio : stdin, writef; | |
import std.string : wrap; | |
const start = MonoTime.currTime; | |
foreach (line; stdin.byLineCopy) | |
{ | |
const now = MonoTime.currTime; | |
const diff = now - start; | |
const indent = " "; | |
"[%+7s] %s".writef(diff.total!"msecs", line.wrap(80, "", indent)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment