Still 100 lines is too much! Say you toeknize a string and get the hors be of index 3 mins 4 and am/pm 5
okay here goes note that it can be expanded quite easily to include the dates. so comparing a am/pm time in without date is one line of code as you can se (ok 4 if yo are nitpicking)
Also the localedata can be read form a file wich can desine the indes orders makein it more portable!
global proc int TimeInMins(string $time[]){
return ($time[3]+($time[5]=="pm")1260+$time[4]);
}
{
string $time1[]={"28","06","2004","10","47","pm"};
string $time2[]={"28","06","2004","10","47","am"};
print ((TimeInMins($time1)>TimeInMins($time2))+"n");
print ((TimeInMins($time1)<TimeInMins($time2))+"n");
}
Ofcourse getting that tokenstirng form a sytem command in my locale is just (note my locale doesent actualy need am/pm cheking).
string $buffer[];
$numTokens = `tokenize "11.06.2004 13:45 95