time = time * 1000 / 300; cal.set(Calendar.MILLISECOND, (int)(time));
time = (int) Math.round(time * 1000 / 300f); cal.set(Calendar.MILLISECOND, time);
    private Object getDatetimeValue(final int type)            throws java.io.IOException, TdsException {        int len;        int daysSince1900;        int time;        int hours;        int minutes;        int seconds;        synchronized (cal) {            if (type == SYBDATETIMN) {                len = comm.getByte(); // No need to & with 0xff            } else if (type == SYBDATETIME4) {                len = 4;            } else {                len = 8;            }            switch (len) {            case 0:                return null;            case 8:                // A datetime is made of of two 32 bit integers                // The first one is the number of days since 1900                // The second integer is the number of seconds*300                // Negative days indicate dates earlier than 1900.                // The full range is 1753-01-01 to 9999-12-31.                daysSince1900 = comm.getTdsInt();                sybaseToCalendar(daysSince1900, cal);                time = comm.getTdsInt();                hours = time / 1080000;                cal.set(Calendar.HOUR_OF_DAY, hours);                time = time - hours * 1080000;                minutes = time / 18000;                cal.set(Calendar.MINUTE, minutes);                time = time - (minutes * 18000);                seconds = time / 300;                cal.set(Calendar.SECOND, seconds);                time = time - seconds * 300;                time = time * 1000 / 300;                cal.set(Calendar.MILLISECOND, (int)(time));////              getTimeInMillis() is protected in java vm 1.3 :-(//              return new Timestamp(cal.getTimeInMillis());//                return new Timestamp(cal.getTime().getTime());            case 4:                // A smalldatetime is two 16 bit integers.                // The first is the number of days past January 1, 1900,                // the second smallint is the number of minutes past                // midnight.                 // The full range is 1900-01-01 to 2079-06-06.                daysSince1900 = ((int) comm.getTdsShort()) & 0xFFFF;                sybaseToCalendar(daysSince1900, cal);                minutes = comm.getTdsShort();                hours = minutes / 60;                cal.set(Calendar.HOUR_OF_DAY, hours);                minutes = minutes - hours * 60;                cal.set(Calendar.MINUTE, minutes);                cal.set(Calendar.SECOND, 0);                cal.set(Calendar.MILLISECOND, 0);//                return new Timestamp(cal.getTimeInMillis());                return new Timestamp(cal.getTime().getTime());            default:                throw new TdsNotImplemented("Invalid DATETIME value with size of " +                                        len + " bytes.");            }        }    }