Syntax highlighting of server-protocol/52d5ab3 ~( Packet_0xB1)

# Packet 0xB1

[TOC]

The server sends clients a Packet 0xB1 to tell them the current time on the server (upon request from the client). The clients send Packet 0xB1 to request said timestamp from the server.

## Dreamcast Packet Format (Server->Client)
| Bytes | Meaning |
| --- | --- |
| 0x00 | Packet Type (0xB1) |
| 0x01 | Flags (0x00) |
| 0x02-0x03 | Packet Size (0x0020) |
| 0x04-0x1F | Timestamp (see below for format) |

### Timestamp Format
C code to format the timestamp (from a `struct timeval` (`rawtime`) and `struct tm` (`cooked`)):

```c
sprintf(pkt->timestamp, "%u:%02u:%02u: %02u:%02u:%02u.%03u",
        cooked.tm_year + 1900, cooked.tm_mon + 1, cooked.tm_mday,
        cooked.tm_hour, cooked.tm_min, cooked.tm_sec,
        (unsigned int)(rawtime.tv_usec / 1000));
```

## Dreamcast Packet Format (Client->Server)
| Bytes | Meaning |
| --- | --- |
| 0x00 | Packet Type (0xB1) |
| 0x01 | Flags (0x00) |
| 0x02-0x03 | Packet Size (0x0004) |