Changeset 386


Ignore:
Timestamp:
1999-07-14T20:30:01+12:00 (25 years ago)
Author:
rjmcnab
Message:

fixed an error to do with the way time is dealt with on different machines.
It seems that there is no direct corresponding function to mktime and
localtime or gmtime might not get you back to where you started.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/userdb.cpp

    r373 r386  
    1212/*
    1313   $Log$
     14   Revision 1.2  1999/07/14 08:30:01  rjmcnab
     15   fixed an error to do with the way time is dealt with on different machines.
     16   It seems that there is no direct corresponding function to mktime and
     17   localtime or gmtime might not get you back to where you started.
     18
    1419   Revision 1.1  1999/07/13 23:22:04  rjmcnab
    1520   Initial revision.
     
    2328
    2429// include crypt
    25 #include <crypt.h>
     30//#include <crypt.h>
     31#include <unistd.h>
    2632
    2733
     
    284290    if (info["user"] == thisuser.username) {
    285291      time_t keycreation = text2time (info["time"]);
    286       if (keycreation != (time_t)-1 && difftime (time(NULL), keycreation) <= keydecay) {
     292      if (keycreation != (time_t)-1 && difftime (text2time(time2text(time(NULL))),
     293                         keycreation) <= keydecay) {
    287294    // succeeded, update the key's time
    288295    info["time"] = time2text(time(NULL));
     
    319326  text_t key = keydb.getfirstkey ();
    320327  infodbclass info;
    321   time_t timenow = time(NULL);
     328  time_t timenow = text2time(time2text(time(NULL)));
    322329  time_t keycreation = (time_t)-1;
    323330  while (!key.empty()) {
Note: See TracChangeset for help on using the changeset viewer.