public int getTimeTillSpaceGetsAvailable ( ) { long globalRatelimitResetTimestamp = RatelimitBucket . globalRatelimitResetTimestamp . getOrDefault ( api . getToken ( ) , 0L ) ; long timestamp = System . currentTimeMillis ( ) + ( api . getTimeOffset ( ) == null ? 0 : api . getTimeOffset ( ) ) ; if ( ratelimitRemaining > 0 && ( globalRatelimitResetTimestamp - timestamp ) <= 0 ) { return 0 ; } return ( int ) ( Math . max ( ratelimitResetTimestamp , globalRatelimitResetTimestamp ) - timestamp ) ; }
Gets the time in seconds how long you have to wait till there s space in the bucket again .