summaryrefslogtreecommitdiff
path: root/src/common/timer.c
AgeCommit message (Collapse)AuthorFilesLines
2013-12-17Fixed some additional linux warningsHaru1-4/+4
- Fixed some warnings we had missed. - Improved -W cflag detection routines. - Only use -Wshadow if it's actually useful. Signed-off-by: Haru <haru@dotalux.com>
2013-10-30Follow-up to 44c33fda3614d588e6bf6cee1cf884e98f1531f0Haru1-4/+4
Corrected some leftover 32bit typecasts. Special thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>
2013-10-26Changed 'tick' variables to 64 bitHaru1-24/+62
- This fixes an issue with timers that stop working after about 24-49 days when the tick overflows (note that this may happen much earlier than that, and at hard to predict times, on some systems) - Updated the RDTSC help message in the configure script to also warn users about issues with SpeedStep enabled systems. - On Windows, tick() still has a resolution of 10~15ms (or even as low as 100ms on some systems). A TODO comment (thanks, Ai4rei) was added for a follow-up patch, as I want this one to be as small as possible) - Note: on Windows versions earlier than 6.x (Vista, Server 2008), the tick overflow issue is NOT fixed, since they don't support the function used to retrieve a 64 bit tick. This isn't a big issue, since those platforms are already - or going soon to be - out of their extended support period, and it's already advisable to upgrade, for other reasons. If you're the unfortunate user of such a system, it is recommended that you reboot your machine at least once every 49 days for Hercules to work reliably. - Note: To clear some doubts, since I've already been asked, this has absolutely NOTHING to do with 32/64 bit CPUs or OSes. It's all about a variable's size, not the size of registers of your CPU, and your 32bit CPU will be able to handle this just fine. Signed-off-by: Haru <haru@dotalux.com>
2013-09-25Renamed iTimer interface to timer.shennetsind1-16/+18
Also removed duplicate mentions of timer within calls to shorten.
2013-07-22Binary heap fix & improvement.Piotr Hałaczkiewicz1-4/+4
Fixed a bug when removing last element of binary heap (its parent would be removed instead if it had the same value). Binary heap now allows custom swapper function/macro. Added `swap_ptr` macro to swap two pointers in place (`swap` is not suitable for pointers). This allows to store pointers in binary heap.
2013-06-07Hercules Renewal Phase One : pc, party, map, timerSusu1-13/+24
Added iPc, iParty, iMap, iTimer to HPM exported interfaces
2013-05-16Fixed Bug #7249shennetsind1-4/+4
System-dependent function name conflict solved. http://hercules.ws/board/tracker/issue-7249-error-compiling-timerc/ Signed-off-by: shennetsind <ind@henn.et>
2013-05-15HPM Updateshennetsind1-72/+63
Made SQL and strlib functions HPM-friendly, special thanks to Yommy for bringing the issue up. Added partial map.c support, for the all-handy map[] array, beware that soon the whole map.c renewal design will be commit and when that happens your usage of map.c functions in plugins might require some updates. Signed-off-by: shennetsind <ind@henn.et>
2012-12-05- Undid r16968: SVN Replaced with source:/trunk/src/@16966 (tid:74924).brianluau1-236/+243
[16969:16991/trunk/src/] will be re-committed in the next 24 hours. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16992 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-11-25Applied AStyle code formating as discussed on tid:74602.greenboxal21-243/+236
Removed /SAFESEH option from MSVC11 projects. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16968 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-06-03cleaned up windows header usage (added one central file to use windows / ↵blacksirius1-2/+1
winapi specific stuff, to be able to set the appropriate flags before including it correctly) Note: this may screw up mingw or cygwin building, ill fix it later... git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16219 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-01-30- Removed trailing tabs, and fixed some spacing.brianluau1-1/+1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15524 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-06-30Replaced custom type 'intptr' with standard 'intptr_t'.ultramage1-2/+2
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14873 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-04-05* Moved detection of monotonic clock support to the configure script, which ↵ai4rei1-1/+1
also checks, whether or not it actually works (bugreport:1003, related r11912 and r11983). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14767 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-03-16added --enable-rdtsc configure option to enhance timer performance, ↵Yommy1-0/+45
especially in virtualized environments; default disabled - credits to sirius_black git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14265 54d463be-8e91-2dee-dedb-b68131a5f0ec
2009-01-21* Replaced the fake timer heap (sorted array) with a real heap. (improves ↵FlavioJS1-98/+38
performance) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13465 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-11-22* Hunted down the simpler 64bit pointer truncations.FlavioJS1-6/+6
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13380 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-07-26Partially reverted the timer code changes from r12926 - r12969.ultramage1-224/+110
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12999 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-07-20ops ('|'->'&' in delete_timer debug code)FlavioJS1-1/+1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12969 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-07-20* Simplified the search in pop_timer_heap and added more debug info to help ↵FlavioJS1-6/+15
determine the source condition of timer errors. (bugreport:1860) * Fixed crash in skill_castend_id. (bugreport:1860) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12968 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-07-16* Added a check to make sure only released timers are acquired from the free ↵FlavioJS1-3/+3
list. * Changed TIMER_MAX_INTERVAL to 1 second (was set to 1 minute by mistake). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12963 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-07-15* Fixed pop_timer_heap using max heap comparisons instead of min heap ↵FlavioJS1-21/+40
comparisons and protected timer functions against improper use. (should fix bugreport:1833 bugreport:1841) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12956 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-07-09* Added const to the return value of get_timer.FlavioJS1-147/+232
* Added a maximum timer interval. Avoids server shutdowns being delayed for ~10 seconds under some circumstances on windows. * Replaced the fake timer heap (ordered array) with a binary min heap. (actually, this is just a merge and has been in use for months) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12926 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-06-18Fixed a bug in the timer code which made it impossible to delete a timer ↵ultramage1-1/+1
with id '0' (since pre-svn, still present in jAthena). Fixed wrong order of parameters in a ShowWarning call when freeing a locked DBMap, which caused a segfault when executed (since initial implementation in r4859). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12854 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-04-27Removed the calc_times() no-op (bugreport:1289)ultramage1-7/+0
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12668 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-04-21* Changed the data field of timers from int to intptr.FlavioJS1-2/+2
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12633 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-03-17- Clean up of calc_times function.zephyrus1-0/+6
- Moved to timer.c/h because it's used in both map and char servers. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12382 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-27* Tweeked the declaration and initialization defines for vectors.FlavioJS1-2/+4
* Made do_sockets leave the for loop as soon as the readable number of sockets returned by select is found. * Made all posix compliant systems that support it and FreeBSD >= 5.1 (implements it but doesn't have the posix defines) use the precise and consistent tick() implementation. * Minor tweek to HEAP_SEARCH (same variable can be used in from and to). * Fixed the map server not exiting when make_listen_bind fails and returns -1. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11983 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-14Added a precise and consistent tick() function for freebsd (see bugreport:240)ultramage1-1/+5
(TODO: apply it to multiple platforms using an appropriate configure script) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11912 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-07- removed the timer heap correction code when the timers overflow since ↵skotlex1-33/+0
Flavio points out that it is not needed. - Modified a bit the changesex code so you get saved and quit before changing your sex rather than afterwards. - Cleaned up #changesex - Signum Crucis now works on bosses. - party_recv_data will not set the sd pointer for not-yet-authed characters. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11867 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-03Tried to make sense out of timer.c ... and failedultramage1-64/+86
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11647 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-18Fixed unix compilation problem due to a missing include (caused by r11499)ultramage1-0/+2
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11506 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-17* small timer.c cleaningultramage1-85/+53
- removed "with less than 4 values, it's speedier to use a simple loop" as this case will never occur (premature optimization from r1284) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11499 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-09-25* Fixed the double free's caused by r11290 (wrong option in the database ↵FlavioJS1-0/+3
constructors). Readded tick cache variables (deleted by mistake). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11292 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-09-25* Disabled tick cache (to enable it: define TICK_CACHE to the number of ↵FlavioJS1-5/+24
calls that should be cached). * Added a charid2sd database for fast charid searches. * Reworked the nick cache to only contain offline characters. Note: The tick cache was causing _some_ of the desync problems in eA. Gameplay should be much smother, but desync problems still exist. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11290 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-08-15* Some serious code cleanupsultramage1-4/+2
- adjusted @reloadbattleconf to not depend on variable ordering - changed all battle vars to 'int' (removes pointless duplicit coding) - added min, max and default columns to battle config data structure - added properly bounded values for these columns (or at least tried to) - battle-conf loading will now complain if it finds unknown settings, and will reject values that are outside of the allowed range - added CHATROOM_TITLE_SIZE and CHATROOM_PASS_SIZE - partially cleaned up chatroom manipulation code * Fixed 'Job_Professer' typo in mage jobchange quest git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11017 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-05-19Reformatting @_@ultramage1-4/+2
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10581 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-05-05* Removed the dependency on winsock.h for definitions, it's all winsock2.h now.FlavioJS1-8/+9
* Minor documentation/re-coding in chat.c. * More work on ticket #41. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10471 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-01-26- Added a wrapper to delete_timer so it prints out from where the invocation ↵skotlex1-2/+4
was done. - Fixed some unsigned warnings. - Fixed Splash attacks consuming 2 ammo on each attack. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9718 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-01-07Undid the memset->malloc_set replacementultramage1-3/+3
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9626 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-12-23- Moved "#include <limits.h>" to cbasetypes.h to ensure it's included before ↵FlavioJS1-1/+0
checking if UINT_MAX has been defined. - Minor changes in pc_readdb related to max_level being unsigned. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9561 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-12-22- Change strncpy to memcpy when parsing switches in the script engine since ↵FlavioJS1-2/+4
it's guaranteed to be a word of that size (skip_word). - Made scriptlabel_db duplicate the key. When str_buf is reallocated, the keys in scriptlabel_db could become invalid, causing a crash in npc_convertlabel_db. ( removed the readded >=0x81 equivalent ) - Now npc_convertlabel_db clears scriptlabel_db after using it. - parse_script has an extra parameter options. At the moment it only indicates if scriptlabel_db should be used or not. - Fixed "UINT_MAX undeclared" on systems that don't declare it in limits.h git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9557 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-12-19- Added missing include of system header limits.h to timer.cskotlex1-2/+1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9523 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-12-19- Reverted the mob ThinkTime update, that field is again aDelay as it ↵skotlex1-1/+1
apparently should be. - Fixed one small compilation error. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9522 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-12-19- Cleanups or minor changes.FlavioJS1-111/+139
- Now addtick_timer invokes settick_timer, so keep an eye for whatever timer issues it's supposed to have. - Removed the flush_fifo from clif_parse_TickSend until the socket problems are fixed. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9521 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-12-05- Massive EOL normalization & 'svn:eol-style native' flag setting for all ↵FlavioJS1-436/+436
txt/conf/h/c files. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9410 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-09-12- Moved the packet_len variable in login.c to the login parse case, since ↵skotlex1-1/+1
it's used nowhere else. - timestamp check speed-up in showmsg.c - Swapped the blank ShowMessage on server startup to a printf - Homunculus intimacy will go back to 500 on evolution. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8719 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-09-01The "delete_timer error/no such timer" report will now print the related ↵toms1-1/+1
function git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8586 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-08-27* Optional macro MEMSET_TURBO for faster low-level memory initializations.Lance1-4/+4
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8499 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-02-20- Added back the char-sql server sending the GM list when the map server ↵skotlex1-1/+1
connects. - Fixed a bug in the add_timer_interval error reporting. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5351 54d463be-8e91-2dee-dedb-b68131a5f0ec