1

I am using QNX to compare dates of files created. Using QNX I cannot use any of the commonly referenced answers to this frequent question.

I cannot use date for anything other than current date modification

Any other ideas out there?

G. Cito
  • 6,210
  • 3
  • 29
  • 42
  • Some of us recently tried to answer a [related question concerning QNX and the `find` and `date` utilities](http://stackoverflow.com/q/17725526/2019415). – G. Cito Aug 01 '13 at 00:03
  • I added a bash tag even though QNX really uses `ksh/sh`. This is just an attempt to get more shell experts looking at this question. Feel free to remove that tag. – G. Cito Aug 01 '13 at 15:14

1 Answers1

1

The QNX shell environment is a mix of GNU extensions and POSIX components and lacks some widely available basic features in several utilities. As well, the command switches that are often referenced in Unix, OSX. Linux documentation for finding file creation/modification/access dates and for comparing or converting these dates to epoch time for ease of date calculation in the shell (date arithmetic), are not supported.

As I noted in my comment this was discussed in another question recently. QNX's find has GNU -printf extensions so can be used for part of this but this must use QNX strftime which seems to lack support for formatting dates as epoch values. In one of my answers to that question I show how to use GNU find to get date information from files. QNX's date lacks the -s, -d, and --date switches from GNU coreutils date for easy conversions nor does it include modern BSD/POSIX -j and -f switches (which work for conversion to/from epoch to current time). BSD date also includes date adjustment with its -v switch for doing basic date arithmetic. This is similar to the functionality offered by the --date switch of GNU date. These are useful and basic functions that would be needed for running/porting a lot of existing shell scripts, but QNX doesn't seem to have them.

Some hackish workarounds are demoed at the question linked to above. Hopefully QNX gurus will show the correct methods (sh/ksh tricks?) for doing this or feature requests will prompt QNX to update some of these core Unix/POSIX utilities :-)

Cheers,

Community
  • 1
  • 1
G. Cito
  • 6,210
  • 3
  • 29
  • 42