SunOS compare datetime

Hi

i need to compare the datetime between 2 columns.
SunOS 5.1 is used. Notice that mktime seems like not supported.

cat file2

P1,2012 12 4 21 36 48,2012 12 4 22 26 53
P2,2012 12 4 20 36 48,2012 12 4 21 21 23
P3,2012 12 4 18 36 48,2012 12 4 20 12 35

Below is the command used.

/usr/xpg4/bin/awk -F, '{d2=mktime($3);d1=mktime($2);print $1","d2-d1,"secs";}' file2
/usr/xpg4/bin/awk: line 0 (NR=1): variable "" cannot be used as a function

awk -F, '{d2=mktime($3);d1=mktime($2);print $1","d2-d1,"secs";}' file2
0

I think mktime is a GNU-awk extension - try using gawk .

print $1","d2-d1,"secs"

Also, these quotes don't look right.