README.md (1879B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # now 22 23 > Time in seconds since the epoch. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var now = require( '@stdlib/time/now' ); 31 ``` 32 33 #### now() 34 35 Returns the time in **seconds** since the epoch. 36 37 ```javascript 38 var ts = now(); 39 // returns <number> 40 ``` 41 42 </section> 43 44 <!-- /.usage --> 45 46 <section class="notes"> 47 48 ## Notes 49 50 - The [Unix epoch][unix-time] is 00:00:00 UTC on 1 January 1970. 51 52 </section> 53 54 <!-- /.notes --> 55 56 <section class="examples"> 57 58 ## Examples 59 60 <!-- eslint no-undef: "error" --> 61 62 ```javascript 63 var now = require( '@stdlib/time/now' ); 64 65 var t0 = now(); 66 67 setTimeout( onTimeout, 2000 ); 68 69 function onTimeout() { 70 var t1 = now(); 71 console.log( 'Seconds elapsed: %d', t1-t0 ); 72 } 73 ``` 74 75 </section> 76 77 <!-- /.examples --> 78 79 * * * 80 81 <section class="cli"> 82 83 ## CLI 84 85 <section class="usage"> 86 87 ### Usage 88 89 ```text 90 Usage: now [options] 91 92 Options: 93 94 -h, --help Print this message. 95 -V, --version Print the package version. 96 ``` 97 98 </section> 99 100 <!-- /.usage --> 101 102 <section class="notes"> 103 104 </section> 105 106 <!-- /.notes --> 107 108 <section class="examples"> 109 110 ### Examples 111 112 ```bash 113 $ now 114 <number> 115 ``` 116 117 </section> 118 119 <!-- /.examples --> 120 121 </section> 122 123 <!-- /.cli --> 124 125 <section class="links"> 126 127 [unix-time]: https://en.wikipedia.org/wiki/Unix_time 128 129 </section> 130 131 <!-- /.links -->