I am trying to get system time in scope of the extrinsic call execution of the substrate pallet. It should work independent on target arch (wasm, unix, etc.) and build mode (std, no_std)
Using std::time::SystemTime, chrono or wasm-timer libraries are not an option as they heavily depend on std.
Referencing timestamp pallet in scope of the custom pallet also not an option, as at any moment it provides on-chain timestamp, which is current or next block timestamp.
Questions:
is there a way to get system/actual-current timestamp in scope of pallet "functions" using substrate means
how the timestamp/now value of pallet-timestamp is initialized when node is started and incremented during runtime (what is the source of it)
could you suggest any library providing such means that can be linked with pallet without facing similar errors below
Compiling pallet-template v3.0.0-monthly-2021-08 (/workspace/supra/examples/concurrency_poc/node/pallets/template)
error: duplicate lang item in crate `std` (which `wasm_timer` depends on): `panic_impl`.
|
= note: the lang item is first defined in crate `sp_io` (which `frame_support` depends on)
= note: first definition in `sp_io` loaded from /workspace/supra/examples/concurrency_poc/node/target/debug/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-e941cef754f8762e.rmeta
= note: second definition in `std` loaded from /home/areg/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libstd-0c448d560077210c.rlib
error: duplicate lang item in crate `std` (which `wasm_timer` depends on): `oom`.
|
= note: the lang item is first defined in crate `sp_io` (which `frame_support` depends on)
= note: first definition in `sp_io` loaded from /workspace/supra/examples/concurrency_poc/node/target/debug/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-e941cef754f8762e.rmeta
= note: second definition in `std` loaded from /home/areg/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libstd-0c448d560077210c.rlib