awk -F, 'BEGIN { OFS=FS=","; }
{
seconds=substr($1, index($1, ".")-2, 10);
ms=substr(seconds, 7);
seconds=substr(seconds, 1, 6);
if (ms > 5000)
seconds += 0.001;
$1=sprintf("%s%6.3f", substr($1, 1, index($1, ".") - 2), seconds);
print
}' < input
This simply brute-forces the timestamp fields out of the first parameter then checks to see whether the time should be rounded up or not. With the new time value in hand, it reassembles the timestamp field back into `$1` and then prints the new line.