# MonotonicTimestampGenerator

<div class="jsdoc-content"><header>
    
        <h2><span class="attribs"><span class="type-signature"></span></span>
            <span class="ancestors"><a href="index.html">policies/timestampGeneration</a>~</span>MonotonicTimestampGenerator<span class="signature">(warningThreshold<span class="signature-attributes">opt</span>, minLogInterval<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h2>
        
            <div class="class-description"><p>A timestamp generator that guarantees monotonically increasing timestamps and logs warnings when timestamps
drift in the future.</p>
<p>Date has millisecond precision and client timestamps require microsecond precision. This generator
keeps track of the last generated timestamp, and if the current time is within the same millisecond as the last,
it fills the microsecond portion of the new timestamp with the value of an incrementing counter.</p></div>
        
    
</header>


    
        

    
    </div>

## Constructor

<div class="jsdoc-content">
    

    
    <h4 class="name" id="MonotonicTimestampGenerator"><span class="type-signature"></span>new MonotonicTimestampGenerator<span class="signature">(warningThreshold<span class="signature-attributes">opt</span>, minLogInterval<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
    

    











    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>warningThreshold</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>Determines how far in the future timestamps are allowed to drift before a
warning is logged, expressed in milliseconds. Default: <code>1000</code>.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>minLogInterval</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>In case of multiple log events, it determines the time separation between log
events, expressed in milliseconds. Use 0 to disable. Default: <code>1000</code>.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/policies/timestamp-generation.js#L63" target="_blank" rel="noopener">policies/timestamp-generation.js, line 63</a></p></div>




















    
    

    
        </div>

## Extends

<div class="jsdoc-content">

        


    <ul>
        <li>TimestampGenerator</li>
    </ul>


    

    

    

    

    

    

    

    
        </div>

## Methods

<div class="jsdoc-content">

        
            

    

    
    <h4 class="name" id="getDate"><span class="type-signature"></span>getDate<span class="signature">()</span><span class="type-signature"> &rarr; {Number}</span></h4>
    

    



<div class="description">
    <p>Returns the current time in milliseconds since UNIX epoch</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/policies/timestamp-generation.js#L98" target="_blank" rel="noopener">policies/timestamp-generation.js, line 98</a></p></div>















<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Number</span>


    </dd>
</dl></div>
