summaryrefslogtreecommitdiff
path: root/src/char_sql
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-03-17 15:03:03 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-03-17 15:03:03 +0000
commit372b71e5d7099373a20b14459182f9a3a05dbbba (patch)
treea53255abc00fe17d0b870d368cb0a7bed5aa2aa2 /src/char_sql
parenta0d17427e9b773d175aca334f20fcffd56edf5d9 (diff)
downloadhercules-372b71e5d7099373a20b14459182f9a3a05dbbba.tar.gz
hercules-372b71e5d7099373a20b14459182f9a3a05dbbba.tar.bz2
hercules-372b71e5d7099373a20b14459182f9a3a05dbbba.tar.xz
hercules-372b71e5d7099373a20b14459182f9a3a05dbbba.zip
- Clean up of calc_times function.
- 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
Diffstat (limited to 'src/char_sql')
-rw-r--r--src/char_sql/int_auction.c10
-rw-r--r--src/char_sql/int_mail.c12
2 files changed, 5 insertions, 17 deletions
diff --git a/src/char_sql/int_auction.c b/src/char_sql/int_auction.c
index a21dbb22f..2e5e90c1d 100644
--- a/src/char_sql/int_auction.c
+++ b/src/char_sql/int_auction.c
@@ -23,12 +23,6 @@ void auction_delete(struct auction_data *auction);
static int auction_end_timer(int tid, unsigned int tick, int id, int data);
// Copy Paste from map/mail.c
-time_t calc_times(void)
-{
- time_t temp = time(NULL);
- return mktime(localtime(&temp));
-}
-
static int auction_count(int char_id, bool buy)
{
int i = 0;
@@ -86,7 +80,7 @@ unsigned int auction_create(struct auction_data *auction)
if( !auction )
return false;
- auction->timestamp = (int)calc_times() + (auction->hours * 3600);
+ auction->timestamp = calc_times() + (auction->hours * 3600);
StringBuf_Init(&buf);
StringBuf_Printf(&buf, "INSERT INTO `%s` (`seller_id`,`seller_name`,`buyer_id`,`buyer_name`,`price`,`buynow`,`hours`,`timestamp`,`nameid`,`item_name`,`type`,`refine`,`attribute`", auction_db);
@@ -184,7 +178,7 @@ void inter_auctions_fromsql(void)
struct item *item;
char *data;
StringBuf buf;
- unsigned int tick = gettick(), endtick, now = (unsigned int)calc_times();
+ unsigned int tick = gettick(), endtick, now = calc_times();
StringBuf_Init(&buf);
StringBuf_AppendStr(&buf, "SELECT `auction_id`,`seller_id`,`seller_name`,`buyer_id`,`buyer_name`,"
diff --git a/src/char_sql/int_mail.c b/src/char_sql/int_mail.c
index 9ae4e1ccd..86a076b0d 100644
--- a/src/char_sql/int_mail.c
+++ b/src/char_sql/int_mail.c
@@ -7,6 +7,7 @@
#include "../common/socket.h"
#include "../common/strlib.h"
#include "../common/sql.h"
+#include "../common/timer.h"
#include "char.h"
#include "inter.h"
@@ -14,13 +15,6 @@
#include <string.h>
#include <stdlib.h>
-static time_t calc_times(void)
-{
- time_t temp = time(NULL);
- return mktime(localtime(&temp));
-}
-
-
static int mail_fromsql(int char_id, struct mail_data* md)
{
int i, j;
@@ -359,7 +353,7 @@ static void mapif_Mail_return(int fd, int char_id, int mail_id)
safestrncpy(msg.title, temp_, MAIL_TITLE_LENGTH);
msg.status = MAIL_NEW;
- msg.timestamp = (unsigned int)calc_times();
+ msg.timestamp = calc_times();
new_mail = mail_savemessage(&msg);
mapif_Mail_new(&msg);
@@ -444,7 +438,7 @@ void mail_sendmail(int send_id, const char* send_name, int dest_id, const char*
if( item != NULL )
memcpy(&msg.item, item, sizeof(struct item));
- msg.timestamp = (int)calc_times();
+ msg.timestamp = calc_times();
mail_savemessage(&msg);
mapif_Mail_new(&msg);