# Module: timeComputation

Contains all of the business rules needed for generating time stamps, reformatting time stamps and computing time durations.

Author:
  - Seth Hollingsead
Copyright:
  - Copyright © 2022-… by Seth Hollingsead. All rights reserved
Source:
  - businessRules/rules/timeComputation.js, line 1

### Requires

- module:loggers
- @haystacks/constants
- moment
- path

### Methods

#### (inner) computeDeltaTime(inputData, inputMetaData) → {integer}

Computes the time difference between two different date-time stamps in milliseconds.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The start of the time period that should be computed.
`inputMetaData` | string | The end of the time period that should be computed.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/timeComputation.js, line 52

##### Returns:

The difference between the beginning time and ending time in milliseconds.

Type
  integer

#### (inner) getNowMoment(inputData, inputMetaData) → {string}

Returns a time stamp string formatted according to the input formatting string.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The formatting string, that tells moment in what format to return the value for the day, month, year, hour, minute, second and millisecond.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/timeComputation.js, line 28

##### Returns:

A time stamp string that has been formatted according to the input format.

Type
  string

#### (inner) reformatDeltaTime(inputData, inputMetaData) → {string}

Converts a time interval into a different kind of format.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | integer | A time interval measured in milliseconds.
`inputMetaData` | string | The formatting template that should be used to format the time interval.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/timeComputation.js, line 75

##### Returns:

A time interval formatted according to the input format template string.

Type
  string

#### (inner) sleep(inputData, inputMetaData) → {void}

Causes the JavaScript code to wait for a period of time defined by the input.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | integer | The number of milliseconds that the system should sleep for.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/timeComputation.js, line 103

##### Returns:

Type
  void