Example usage for com.google.gwt.i18n.shared.impl DateRecord setMilliseconds

List of usage examples for com.google.gwt.i18n.shared.impl DateRecord setMilliseconds

Introduction

In this page you can find the example usage for com.google.gwt.i18n.shared.impl DateRecord setMilliseconds.

Prototype

public void setMilliseconds(int milliseconds) 

Source Link

Document

Set milliseconds field.

Usage

From source file:com.rnb.plategka.shared.DateTimeFormat.java

License:Apache License

/**
 * Method subParseFractionalSeconds parses fractional seconds field.
 * /*from   w ww . j  a v  a  2 s.c om*/
 * @param value
 *            parsed numberic value
 * @param start
 * @param end
 *            parse position
 * @param cal
 *            DateRecord object that holds parsed value
 * @return <code>true</code> if parsing successful, otherwise
 *         <code>false</code>
 */
private boolean subParseFractionalSeconds(int value, int start, int end, DateRecord cal) {
    // Fractional seconds left-justify.
    int i = end - start;
    if (i < 3) {
        while (i < 3) {
            value *= 10;
            i++;
        }
    } else {
        int a = 1;
        while (i > 3) {
            a *= 10;
            i--;
        }
        value = (value + (a >> 1)) / a;
    }
    cal.setMilliseconds(value);
    return true;
}