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)
    
    
    Run

It runs as expected on the Nim Playground:

[https://nim.ide.judge0.com/?ALXWq3cIRsNTEJgkDrhskB8_uUx1](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'
    
    
    Run

Any ideas why this is happening? The code seems beyond basic, but I can't find 
any info on what's going wrong.

Reply via email to