Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Timestamp microsecond for C
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//TIme microsecond //gcc 7.4.0 //QubCIA #include <stdio.h> #include <stdint.h> #include <sys/time.h> int main(void) { struct timeval now; uint64_t timestamp; /* * Current time, represented as seconds and microseconds since * January 1, 1970, 00:00:00 UTC. */ gettimeofday(&now, NULL); /* * Convert to delta in microseconds. */ timestamp = (uint64_t)now.tv_sec * 1000000 + (uint64_t)now.tv_usec; printf("Timeval Sec.Usec = %lu.%lu\n", (uint64_t)now.tv_sec, (uint64_t)now.tv_usec); printf("Timestamp = %llu\n", timestamp); return 0; }
gcc
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 0.12 sec, absolute running time: 0.16 sec, cpu time: 0.01 sec, memory peak: 5 Mb, absolute service time: 0,47 sec
edit mode
|
history
|
discussion
Timeval Sec.Usec = 1613440268.518819 Timestamp = 1613440268518819