Skip to content

lose accuracy with using float for timetick #1

Description

@liues1992

in the code

float HelloWorld::getTimeTick() {
    timeval time;
    gettimeofday(&time, NULL);
    unsigned long millisecs = (time.tv_sec * 1000) + (time.tv_usec / 1000);
    //the millisecs is always 13 demical digits long, however float only have at most 9 significant demical digits.
    return (float)millisecs;
}

As a result, there is only one asteroid spawned in a game.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions