5180 fichiers 38.5 Mo 0 téléchargements 290 vues mis à jour il y a 6 heures ui
nitro-v36-with-renderer-v36 / src / components / mod-tools / views / tradeLockSeconds.ts
tradeLockSeconds.ts 757 o Télécharger le fichier
/** The largest value that survives the wire as a signed int. */
const INT32_MAX = 2147483647;

/**
 * A trade-lock length in hours as the seconds `ModTradingLockMessageComposer` expects.
 *
 * The server adds this to the current time to get `sanctions.trade_locked_until`, an
 * absolute timestamp. Sending minutes made a one-week lock a date in 1970, so the next
 * login read the lock as expired and unlocked the user - and so did a permanent one.
 *
 * The "permanent" sanction is 876000 hours, which as seconds overflows a signed int, so
 * the value is clamped here; the server clamps the timestamp it derives the same way.
 */
export const tradeLockSeconds = (hours: number): number =>
    Math.min(Math.max(Math.round(hours), 1) * 3600, INT32_MAX);
15Sujets
1Dépôts
20Membres
2En ligne
Profile
Inscrit
Dernière visite
Messages
0
Votes positifs
0
Votes négatifs
0

Nous utilisons des cookies pour assurer le bon fonctionnement du site et améliorer votre expérience. en savoir plus

Autoriser