This should be a pretty simple bit of code. I'm trying to pass a dynamic date & time based filename to the camera module on my RaspberryPi.
I've got the following code:
import times
let timestamp = (now().format("yyyy-MM-dd-hh-mm-ss") & ".jpg")
echo(timestamp)
It runs as expected on the Nim Playground:
https://nim.ide.judge0.com/?ALXWq3cIRsNTEJgkDrhskB8_uUx1
However when I compile and run on my RaspberryPi, I get an "unidentified identifier" error on the now() function:
★ Pi-01 ★ MDRSnapperNIM ᐅ nim c -r snapper.nim
Hint: used config file '/etc/nim.cfg' [Conf]
Hint: system [Processing]
Hint: snapper [Processing]
Hint: osproc [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: math [Processing]
Hint: algorithm [Processing]
Hint: os [Processing]
Hint: times [Processing]
Hint: posix [Processing]
Hint: strtabs [Processing]
Hint: hashes [Processing]
Hint: etcpriv [Processing]
Hint: streams [Processing]
Hint: cpuinfo [Processing]
Hint: linux [Processing]
snapper.nim(9, 18) Error: undeclared identifier: 'now'
Any ideas why this is happening? The code seems beyond basic, but I can't find any info on what's going wrong.
Just in case, we now have nightly builds for RPi. Get the armv6 build.
@Stefan_Salewski
That might be it. I installed via apt-get on my RPI and it's version 0,19,4.
@shashlick
Ta. I'll try a Nightly
We don't control what gets put on the apt repositories. It's up to the linux distro to decide what version to include.
It's a lot of work to poke the distro maintainers and tell them to update, and we don't have the manpower to do that all the time. And Nim isn't important enough for them to keep up to date proactively.
This isn't just a Nim problem. Many projects are like this. That is why it is important to check the versions of things you get off apt vs. the project website itself.