-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide the way to measure running time
Add ZSH_VCS_PROMPT_DEBUG_THRESHOLD_MICRO_SEC option
- Loading branch information
Showing
2 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env perl | ||
use strict; | ||
use warnings; | ||
use utf8; | ||
use Time::Local; | ||
use Time::HiRes qw(gettimeofday); | ||
|
||
sub date2timestamp { | ||
my $date = shift; | ||
my ($year, $mon, $day, $hour, $min, $sec, $microsec) = ($date =~ /(\d{4})\-([01]\d)\-([0-3]\d) ([0-2]\d):([0-5]\d):([0-5]\d).(\d*)/); | ||
my $timestamp = timelocal($sec, $min, $hour, $day, $mon - 1, $year); | ||
$timestamp = $timestamp * 1000 * 1000 + $microsec; | ||
return $timestamp; | ||
} | ||
|
||
my($fullSec,$microsec) = gettimeofday(); | ||
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($fullSec); | ||
my $now = sprintf("%04d-%02d-%02d %02d:%02d:%02d.%06d",$year+1900,$mon+1,$mday,$hour,$min,$sec,$microsec); | ||
my $timestamp = &date2timestamp($now); | ||
print "$timestamp\n"; |
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