# TimestampGenerator

<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>TimestampGenerator<span class="signature">()</span><span class="type-signature"></span></h2>
        
            <div class="class-description"><p>Generates client-side, microsecond-precision query timestamps.</p>
<p>Given that Cassandra uses those timestamps to resolve conflicts, implementations should generate
monotonically increasing timestamps for successive invocations of TimestampGenerator.next().</p></div>
        
    
</header>


    
        

    
    </div>

## Constructor

<div class="jsdoc-content">
    

    
    <h4 class="name" id="TimestampGenerator"><span class="type-signature"></span>new TimestampGenerator<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Creates a new instance of TimestampGenerator.</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#L30" target="_blank" rel="noopener">policies/timestamp-generation.js, line 30</a></p></div>




















    
    

    

    

    

    

    

    

    

    
        </div>

## Methods

<div class="jsdoc-content">

        
            

    

    
    <h4 class="name" id="next"><span class="type-signature">(abstract) </span>next<span class="signature">(client)</span><span class="type-signature"> &rarr; {Long|Number|null}</span></h4>
    

    



<div class="description">
    <p>Returns the next timestamp.</p>
<p>Implementors should enforce increasing monotonicity of timestamps, that is,
a timestamp returned should always be strictly greater that any previously returned
timestamp.</p>
<p>Implementors should strive to achieve microsecond precision in the best possible way,
which is usually largely dependent on the underlying operating system's capabilities.</p>
</div>









    <h5>Parameters:</h5>
    

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

        <th>Type</th>

        

        

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

    <tbody>
    

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

            <td class="type">
            
                
<span class="param-type"><a href="../../Client.html">Client</a></span>


            
            </td>

            

            

            <td class="description last"><p>The <a href="../../Client.html">Client</a> instance to generate timestamps to.</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#L49" target="_blank" rel="noopener">policies/timestamp-generation.js, line 49</a></p></div>















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>the next timestamp (in microseconds). If it's equals to <code>null</code>, it won't be
sent by the driver, letting the server to generate the timestamp.</p>
</div>



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

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

<span class="param-type">null</span>


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