I'd like to pass the compile time as a parameter into my embedded program. How can I achieve that?
I think about running the program with something like cargo run -- "2024-04-21T10:06:20Z" to set the internal clock of the target to this timestamp.
But can be any parameter, it's not (yet) so much about the time stamp parsing.
Is there a alternative way via cargo command line? Because I might want by to choose a different timestamp than "now", or also choose not to set the time at all (by leaving out the argument). I wanted to avoid to change a source or config file for this.
Yes, this is where I stumble upon:
With BUILD_TIME="2024-04-21T10:06:20Z";cargo run
I get environment variable 'BUILD_TIME' not defined at compile time
I think I must say, that I'm totally new to rust, so I'm not sure how to set an environment variable.