ios game center submit time and show in leader board

Viewed 3199

in my app i need to submit the time to the game center and i need to show that in Elapsed Time - To the hundredth of a second format.

00:00:00.00

this is the format i want to show in leader board.

In my app im getting the time in following format

ss.SS

ss = seconds SS = hundredth of a second

i converted the value to double before send it to the game center

double newScoreDouble = [newScore doubleValue];

But when i sending the double score to the game center it asking me to convert it to int64_t format. But when i convert it to that format it loses some part of the double value.

double intPart = 0;
double fractPart = modf(newScoreDouble, &intPart);
int isecs = (int)intPart;
int min = isecs / 60;
int sec = isecs % 60;
int hund = (int) (fractPart * 100);

int64_t time_to_send_through_game_center = min*6000 + (sec*100 + hund);

this is the way i convert double to int64_t

Can any one say how to send whole double value to the game center and display it in Elapsed Time - To the hundredth of a second format.

Thanks

1 Answers
Related