How can I create a file with current time - 60 minutes

I'm using k-shell in unix and I want to create a file with the current system time - 60 minutes. I know I can use touch to create the file, but I'm having trouble specifying how tell it to use the current time less 60 minutes. Any ideas???

Use this:

perl -w -e '@mytime=localtime (time - $ARGV[0]); printf "%d%.2d%.2d%.2d%.2d", $mytime[5]+1900,$mytime[4]+1,$mytime[3],$mytime[2],$mytime[1];' 3600

The output of the above command can be used by touch to create a file.

This is part of a script that can find files created in the last few minutes or few hours. That script can be found here.

Thanks. Do you know how I can do this in k-shell instead of pearl?

You only have the date command in ksh and would have to write a script to fiddle with the output of that. The perl version is much easier. Unless you do not have perl installed on your system, I suggest you go with perl.

This needs my datecalc script which is also on this site...

#! /usr/bin/ksh

alias datecalc=./datecalc
set -A t $(date "+%Y %m %e %H %M")
echo "datecalc -a ${t[0]} ${t[1]} ${t[2]} - 1"
if ((${t[3]})) ; then
        ((t[3]=t[3]-1))
else
        set +A t $(datecalc -a ${t[0]} ${t[1]} ${t[2]} - 1) 23 ${t[4]}
fi
year=${t[0]}
typeset -Z2 t

timestamp=${year}${t[1]}${t[2]}${t[3]}${t[4]}

touch -t $timestamp xfile
ls -l xfile

exit 0