opcua example server compilation error with time::Duration vs. chrono::Duration
Alex-K37 opened this issue · 1 comments
I cannot get the simple server example to compile and could use some advice on how to approach this. I have, e.g., switched between "stable" and "nightly" rust, edition 2018 vs. 2021, to no avail. I am fairly new to Rust - so apologies in advance if I overlooked some configuration setting. Rust is either 1.70.0 stable or 1.73.0 nightly.
Cargo.toml:
[package]
name = "opcuatest"
version = "0.1.0"
edition = "2018"
[dependencies]
chrono = "0.4"
log = "0.4"
[dependencies.opcua]
#path = "../../lib"
version = "0.11.0" # OPCUARustVersion
features = ["server", "console-logging"]
rustc output:
error[E0308]: mismatched types
--> /home/compile/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opcua-0.11.0/src/server/subscriptions/monitored_item.rs:263:28
|
263 | elapsed >= sampling_interval
| ------- ^^^^^^^^^^^^^^^^^ expected `chrono::Duration`, found `time::Duration`
| |
| expected because this is `chrono::Duration`
|
= note: `time::Duration` and `chrono::Duration` have similar names, but are actually distinct types
note: `time::Duration` is defined in crate `time`
--> /home/compile/.cargo/registry/src/index.crates.io-6f17d22bba15001f/time-0.1.45/src/duration.rs:45:1
|
45 | pub struct Duration {
| ^^^^^^^^^^^^^^^^^^^
note: `chrono::Duration` is defined in crate `chrono`
--> /home/compile/.cargo/registry/src/index.crates.io-6f17d22bba15001f/chrono-0.4.30/src/duration.rs:55:1
|
55 | pub struct Duration {
| ^^^^^^^^^^^^^^^^^^^
I would appreciate any input on what might be wrong with my environment. I am using CLion.
I assumed, that the simple-server could be implemented as a crate which pulls in opcua as dependency. However, the full checked out opcua git project seems necessary to compile all the example from their respective sub-crate. I close this for now and try to further find my way around. Thank you for providing this.