Skip to content

Instantly share code, notes, and snippets.

@gravejester
Created April 21, 2015 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gravejester/474c6178bc166bff51d7 to your computer and use it in GitHub Desktop.
Save gravejester/474c6178bc166bff51d7 to your computer and use it in GitHub Desktop.
function Start-Timer {
<#
.SYNOPSIS
Set the global timerStart variable.
.EXAMPLE
Start-Timer -Silent
Will set the variable, and not output anything
.EXAMPLE
Write-Verbose (Start-Timer)
Will set the variable, and write the start time to the verbose stream.
.NOTES
Author: Øyvind Kallstad
Date: 19.04.2015
Version: 1.0
#>
[CmdletBinding()]
param (
# Do not output anything.
[Parameter()]
[switch] $Silent = $false
)
$global:timerStart = Get-Date
if (-not($Silent)) {
Write-Output $global:timerStart
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment