summaryrefslogtreecommitdiff
path: root/t/helper/test-tool.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2019-01-27 23:26:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-01-28 18:34:28 (GMT)
commit4419de916493d8a4292e9b78be6c18aa3641d353 (patch)
tree622893b384c6c01dfa87e946a266d33eb8669b6f /t/helper/test-tool.c
parent4b060a4d973ddfb9c8e03585aa5a80253980ed59 (diff)
downloadgit-4419de916493d8a4292e9b78be6c18aa3641d353.zip
git-4419de916493d8a4292e9b78be6c18aa3641d353.tar.gz
git-4419de916493d8a4292e9b78be6c18aa3641d353.tar.bz2
test-date: add a subcommand to measure times in shell scripts
In the next commit, we want to teach Git's test suite to optionally output test results in JUnit-style .xml files. These files contain information about the time spent. So we need a way to measure time. While we could use `date +%s` for that, this will give us only seconds, i.e. very coarse-grained timings. GNU `date` supports `date +%s.%N` (i.e. nanosecond-precision output), but there is no equivalent in BSD `date` (read: on macOS, we would not be able to obtain precise timings). So let's introduce `test-tool date getnanos`, with an optional start time, that outputs preciser values. Note that this might not actually give us nanosecond precision on some platforms, but it will give us as precise information as possible, without the portability issues of shell commands. Granted, it is a bit pointless to try measuring times accurately in shell scripts, certainly to nanosecond precision. But it is better than second-granularity. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/helper/test-tool.c')
0 files changed, 0 insertions, 0 deletions