en-US/about_MyTimer.help.txt

TOPIC
    about_MyTimer
 
SHORT DESCRIPTION
    This module contains several commands designed to work with a very simple timer.
    The commands are based on an extremely basic principal: how much time has
    elapsed between two events? You can easily do this now with New-Timespan
    or simply subtracting one datetime from another. This module takes the
    simplest approach possible: save the current date and time to a read-only
    variable and when you are ready, calculate a timespan from that variable.
    Even though the commands reference a timer object there really isn't
    anything fancy or complicated. It is simply a variable that you can name,
    that has a datetime value.
 
LONG DESCRIPTION
    There's no .NET magic or anything complicated. The module commands are
    designed to make it easier to manage all of this. You can even create
    multiple timers at the same time in case you want to stop them at different
    intervals. When you are ready to stop a timer, run Stop-Mytimer and
    specify the timer name.
 
    Use Get-MyTimer to view the status of all your timers but without stopping
    them. Use Set-MyTimer if you want to modify a setting such as description.
 
    EXPORTING AND IMPORTING
    If you need to persist timers across PowerShell sessions you can export a
    single timer or all timers with Export-MyTimer. Timers will be exported to
    an XML file using Export-Clixml. In the other PowerShell session use
    Import-MyTimer to recreate them in the current session. The running time
    will continue from when they were first created.
 
EXAMPLES
    Create a single timer:
 
    PS C:\> Start-MyTimer -Name A
 
    Start multiple timers:
 
    PS C:\> Start-Mytimer B,C
 
    Start a timer with a description:
 
    PS C:\> Start-Mytimer D -description "work stuff"
 
    Note that timer names must be unique. You can view status of all running
    timers:
 
    PS C:\> get-mytimer
     
    Name Start Duration Running Description
    ---- ----- -------- ------- -----------
    A 10/25/2018 9:59:03 AM 00:01:36.3290476 True
    B 10/25/2018 9:59:09 AM 00:01:29.9847060 True
    C 10/25/2018 9:59:09 AM 00:01:29.9837050 True
    D 10/25/2018 9:59:50 AM 00:00:49.5655160 True work stuff
 
    Stopping a timer will not write anything to the pipeline unless you use
    -Passthru.
 
    PS C:\> stop-mytimer C -passthru
     
    Name Start Duration Running Description
    ---- ----- -------- ------- -----------
    C 10/25/2018 9:59:09 AM 00:02:33.6885171 False
 
    You can also export and import timers if you need them to persist across
    PowerShell sessions. Otherwise the timers are removed when your PowerShell
    session ends.
 
KEYWORDS
    - Timer
    - Timespan