DEADSOFTWARE

fixed player menu titles
[d2df-sdl.git] / src / lib / enet / enettime.pp
1 {$mode objfpc}
2 unit enettime;
4 {
5 ENet - Reliable UDP networking library
7 FreePascal DLL header: enettime.pp
8 Copyright (c) 2015 Dmitry D. Chernov aka Black Doomer
10 Original file: time.h
11 Copyright (c) 2002-2014 Lee Salzman
13 Version 1 for 1.3.12: 25.02.2015
15 Permission is hereby granted, free of charge, to any person obtaining a copy
16 of this software and associated documentation files (the "Software"), to deal
17 in the Software without restriction, including without limitation the rights
18 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19 copies of the Software, and to permit persons to whom the Software is
20 furnished to do so, subject to the following conditions:
22 The above copyright notice and this permission notice shall be included in all
23 copies or substantial portions of the Software.
25 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 SOFTWARE.
32 }
34 interface
36 const
37 ENET_TIME_OVERFLOW = 86400000;
39 //inline macros
40 function ENET_TIME_LESS( const a, b: LongInt ): Boolean; inline;
41 function ENET_TIME_GREATER( const a, b: LongInt ): Boolean; inline;
43 function ENET_TIME_LESS_EQUAL( const a, b: LongInt ): Boolean; inline;
44 function ENET_TIME_GREATER_EQUAL( const a, b: LongInt ): Boolean; inline;
46 function ENET_TIME_DIFFERENCE( const a, b: LongInt ): LongInt; inline;
48 implementation
50 function ENET_TIME_LESS( const a, b: LongInt ): Boolean; inline;
51 begin Result := a - b >= ENET_TIME_OVERFLOW;
52 end;
53 function ENET_TIME_GREATER( const a, b: LongInt ): Boolean; inline;
54 begin Result := b - a >= ENET_TIME_OVERFLOW;
55 end;
57 function ENET_TIME_LESS_EQUAL( const a, b: LongInt ): Boolean; inline;
58 begin Result := not ENET_TIME_GREATER( a, b );
59 end;
60 function ENET_TIME_GREATER_EQUAL( const a, b: LongInt ): Boolean; inline;
61 begin Result := not ENET_TIME_LESS( a, b );
62 end;
64 function ENET_TIME_DIFFERENCE( const a, b: LongInt ): LongInt; inline;
65 begin if a - b >= ENET_TIME_OVERFLOW then Result := b - a else Result := a - b;
66 end;
68 end.