> For the complete documentation index, see [llms.txt](https://docs.lootlocker.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lootlocker.com/game-systems/leaderboards/how-to/use-leaderboards-for-time-based-rankings.md).

# Use Leaderboards for Time Based Rankings

In order to use Leaderboards for Time Based Rankings, we will simply multiply the time by a constant number, such as 1000. Once you get the Leaderboard, you then divide the score by the same constant.

### Submit Score

{% tabs %}
{% tab title="Unity" %}

```csharp
float time = 522.31f;
float timebasedScore = time * 1000f;
string leaderboardKey = "timebased_leaderboardKey";
LootLockerSDKManager.SubmitScore("", (int)timebasedScore, leaderboardKey, (response) =>
{
    if (!response.success)
    {
        Debug.Log("Could not submit score!");
        Debug.Log(response.errorData.ToString());
        return;
    }
});
```

{% endtab %}

{% tab title="Unreal" %}

<figure><img src="/files/LDSY3e3ZQHJyWSt9Afhq" alt=""><figcaption><p><a href="https://blueprintue.com/blueprint/vk8nipjc/">Blueprint example of submitting a timebased score</a></p></figcaption></figure>
{% endtab %}

{% tab title="Godot" %}

<pre class="language-gdscript"><code class="lang-gdscript">
<strong>var leaderboardKey : String = "timebased_leaderboardKey";
</strong>var time : float = 522.31;
var timebasedScore : int = time * 1000;
var response = await LL_Leaderboards.SubmitScore.new(leaderboardKey, timebasedScore).send()
if(!response.success) :
    # Request failed, handle errors
    pass
else:
    # Request succeeded, use response as applicable in your game logic
    pass
</code></pre>

{% endtab %}
{% endtabs %}

### Get Leaderboard List

{% tabs %}
{% tab title="Unity" %}

```csharp
string leaderboardKey = "timebased_leaderboardKey";
LootLockerSDKManager.GetScoreList(leaderboardKey, 10, (response) => 
{ 
    if(response.success)
    {
        Debug.Log("Could not get scores!");
        Debug.Log(response.errorData.ToString());
        return;
    }

    foreach(var entries in response.items)
    {
        float timebasedScore = entries.score / 1000;
        Debug.Log($"Player {entries.player.name} had a time of {timebasedScore} ranking them {entries.rank} on the Leaderboard");
    }
});
```

{% endtab %}

{% tab title="Unreal" %}

<figure><img src="/files/fNRoRpxJBVPWIkryvcpf" alt=""><figcaption><p><a href="https://blueprintue.com/blueprint/p4ta1bg0/">Blueprint example of getting a time based rank</a></p></figcaption></figure>
{% endtab %}

{% tab title="Godot" %}

<pre class="language-gdscript"><code class="lang-gdscript">
<strong>var leaderboardKey : String = "timebased_leaderboardKey";
</strong>var response = await LL_Leaderboards.GetScoreList.new(leaderboardKey, count).send()
if(!response.success) :
    # Request failed, handle errors
    pass
else:
    for leaderboardEntry in response.items:
        var timebasedScore = leaderboardEntry.score / 1000.0;
        print("Player " + leaderboardEntry.player.name + " had a time of " + timebasedScore +" ranking them " + leaderboardEntry.rank + "on the Leaderboard");
    # Request succeeded, use response as applicable in your game logic
    pass
</code></pre>

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.lootlocker.com/game-systems/leaderboards/how-to/use-leaderboards-for-time-based-rankings.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
