fixed: there were mktime() used on some dirs Items

so sometimes the time of the dir was changed

now for converting tm into time_t use:
time_t Time(const tm & par);
time_t Time(const tm * par);
tm     Time(time_t par);
from core/misc.h

now winix internally use GMT time
only when printing it is converted to local user time
temporarily all users use the same local time (config: time_zone_offset)
(only logs are genereted with local system time)

added to system:
time_t LocalTime(time_t gmt_time);
tm     LocalTime(const tm * ptm);
tm     LocalTime(const tm & ptm);
they convert GMT time to local user time




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@666 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-10-23 23:12:47 +00:00
parent a1bee81a5b
commit c48241f78a
33 changed files with 298 additions and 167 deletions

View File

@@ -102,7 +102,7 @@ funticket.o: ../../core/plugindata.h ../../core/config.h ../../core/notify.h
funticket.o: ../../templatesnotify/templatesnotify.h ../../../ezc/src/ezc.h
funticket.o: ../../core/mount.h ../../core/locale.h ../../templates/misc.h
funticket.o: ../../templates/localefilter.h ../../core/locale.h
funticket.o: ../../core/system.h
funticket.o: ../../core/system.h ../../core/misc.h
init.o: tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h
init.o: ../../db/dbtextstream.h ../../core/textstream.h ../../core/error.h
init.o: ../../core/log.h funticket.h ticketinfo.h ticketparser.h ticketconf.h

View File

@@ -7,9 +7,10 @@
*
*/
#include "funticket.h"
#include <ctime>
#include <algorithm>
#include "funticket.h"
#include "core/misc.h"
@@ -101,8 +102,8 @@ bool FunTicket::SortByDate::operator()(const Item * item1, const Item * item2)
tm tm1 = item1->date_creation;
tm tm2 = item2->date_creation;
time_t time1 = mktime(&tm1);
time_t time2 = mktime(&tm2);
time_t time1 = Time(tm1);
time_t time2 = Time(tm2);
return time1 < time2;
}

View File

@@ -86,7 +86,7 @@ std::vector<Ticket>::iterator i;
for(i=ticket_tab.begin() ; i!=ticket_tab.end() ; ++i)
{
Item * dir = system->dirs.GetDir(i->dir_id);
i->sort_id = ( dir ) ? (unsigned long)mktime(&dir->date_creation) : 0;
i->sort_id = ( dir ) ? (unsigned long)Time(dir->date_creation) : 0;
}
std::sort(ticket_tab.begin(), ticket_tab.end(), SortTicketsFun);