goto retry;
}
- tclient->LastCall = thost->LastCall = FT_ApproxTime();
+ tclient->LastCall = thost->LastCall = time(NULL);
if (activecall) /* For all but "GetTime", "GetStats", and "GetCaps" calls */
thost->ActiveCall = thost->LastCall;
if (restartedat.tv_sec == 0) {
/* I'm not really worried about when we restarted, I'm */
/* just worried about when the first VBUSY was returned. */
- FT_GetTimeOfDay(&restartedat, 0);
+ gettimeofday(&restartedat, 0);
if (busyonrst) {
FS_LOCK;
afs_perfstats.fs_nBusies++;
return (busyonrst ? VBUSY : restarting);
} else {
struct timeval now;
- FT_GetTimeOfDay(&now, 0);
+ gettimeofday(&now, 0);
if ((now.tv_sec - restartedat.tv_sec) < (11 * 60)) {
if (busyonrst) {
FS_LOCK;
Date currDate; /*Current date */
int writeIdx; /*Write index to bump */
int timeIdx; /*Authorship time index to bump */
+ time_t now;
parentptr->disk.dataVersion++;
newlength = (afs_fsize_t) afs_dir_Length(dir);
* directory operation. Get the current time, decide to which time
* slot this operation belongs, and bump the appropriate slot.
*/
- currDate = (FT_ApproxTime() - parentptr->disk.unixModifyTime);
+ now = time(NULL);
+ currDate = (time(NULL) - parentptr->disk.unixModifyTime);
timeIdx =
(currDate < VOL_STATS_TIME_CAP_0 ? VOL_STATS_TIME_IDX_0 : currDate <
VOL_STATS_TIME_CAP_1 ? VOL_STATS_TIME_IDX_1 : currDate <
parentptr->disk.author = author;
parentptr->disk.linkCount = linkcount;
- parentptr->disk.unixModifyTime = FT_ApproxTime(); /* This should be set from CLIENT!! */
- parentptr->disk.serverModifyTime = FT_ApproxTime();
+ parentptr->disk.unixModifyTime = time(NULL); /* This should be set from CLIENT!! */
+ parentptr->disk.serverModifyTime = time(NULL);
parentptr->changed_newTime = 1; /* vnode changed, write it back. */
}
* file operation. Get the current time, decide to which time
* slot this operation belongs, and bump the appropriate slot.
*/
- currDate = (FT_ApproxTime() - targetptr->disk.unixModifyTime);
+ currDate = (time(NULL) - targetptr->disk.unixModifyTime);
timeIdx =
(currDate <
VOL_STATS_TIME_CAP_0 ? VOL_STATS_TIME_IDX_0 : currDate <
} else { /* other: date always changes, but perhaps to what is specified by caller */
targetptr->disk.unixModifyTime =
(InStatus->Mask & AFS_SETMODTIME ? InStatus->
- ClientModTime : FT_ApproxTime());
+ ClientModTime : time(NULL));
}
if (InStatus->Mask & AFS_SETOWNER) {
/* admin is allowed to do chmod, chown as well as chown, chmod. */
}
}
}
- targetptr->disk.serverModifyTime = FT_ApproxTime();
+ targetptr->disk.serverModifyTime = time(NULL);
if (InStatus->Mask & AFS_SETGROUP)
targetptr->disk.group = InStatus->Group;
/* vnode changed : to be written back by VPutVnode */
ViceLog(0, ("WARNING: CallBackTime == 0!\n"));
CallBack->ExpirationTime = 0;
} else
- CallBack->ExpirationTime = CallBackTime - FT_ApproxTime();
+ CallBack->ExpirationTime = CallBackTime - time(NULL);
CallBack->CallBackVersion = CALLBACK_VERSION;
CallBack->CallBackType = CB_SHARED; /* The default for now */
int writeVnode = targetptr->changed_oldTime; /* save original status */
targetptr->changed_oldTime = 1; /* locking doesn't affect any time stamp */
- Time = FT_ApproxTime();
+ Time = time(NULL);
switch (LockingType) {
case LockRead:
case LockWrite:
GetStatus(Vnode * targetptr, AFSFetchStatus * status, afs_int32 rights,
afs_int32 anyrights, Vnode * parentptr)
{
- int Time =FT_ApproxTime();
+ int Time = time(NULL);
/* initialize return status from a vnode */
status->InterfaceVersion = 1;
{
/* Fix this sometime soon.. */
/* Because hey, it's not like we have a network monitoring protocol... */
- struct timeval time;
- /* this works on all system types */
- FT_GetTimeOfDay(&time, 0);
- stats->CurrentTime = time.tv_sec;
+ stats->CurrentTime = time(NULL);
} /*SetSystemStats */
void
FS_UNLOCK;
h_GetWorkStats((int *)&(stats->WorkStations),
(int *)&(stats->ActiveWorkStations), (int *)0,
- (afs_int32) (FT_ApproxTime()) - (15 * 60));
+ (afs_int32) (time(NULL)) - (15 * 60));
} /*SetAFSStats */
struct rx_connection *tcon = rx_ConnectionOf(acall);
struct host *thost;
struct client *t_client = NULL; /* tmp ptr to client data */
- struct timeval time;
struct fsstats fsstats;
fsstats_StartOp(&fsstats, FS_STATS_RPCIDX_GETSTATISTICS);
h_GetWorkStats64(&(Statistics->ViceStatistics64_val[STATS64_WORKSTATIONS]),
&(Statistics->ViceStatistics64_val[STATS64_ACTIVEWORKSTATIONS]),
0,
- (afs_int32) (FT_ApproxTime()) - (15 * 60));
+ (afs_int32) (time(NULL)) - (15 * 60));
-
-
- /* this works on all system types */
- FT_GetTimeOfDay(&time, 0);
- Statistics->ViceStatistics64_val[STATS64_CURRENTTIME] = time.tv_sec;
+ Statistics->ViceStatistics64_val[STATS64_CURRENTTIME] = time(NULL);
Bad_GetStatistics64:
code = CallPostamble(tcon, code, thost);
* Record the time of day and the server version number.
*/
*a_srvVersionNumP = AFS_XSTAT_VERSION;
- *a_timeP = FT_ApproxTime();
+ *a_timeP = (afs_int32) time(NULL);
/*
* Stuff the appropriate data in there (assume victory)
rx_NewConnection(htonl(0x7f000001), htons(7003), 52, vlSec, 0);
rx_SetConnDeadTime(vlConn, 15); /* don't wait long */
}
- if (down && (FT_ApproxTime() < lastDownTime + 180)) {
+ if (down && (time(NULL) < lastDownTime + 180)) {
return 1; /* failure */
}
down = 0; /* call worked */
if (code) {
if (code < 0) {
- lastDownTime = FT_ApproxTime(); /* last time we tried an RPC */
+ lastDownTime = time(NULL); /* last time we tried an RPC */
down = 1;
}
return code;
FS_LOCK;
AFSCallStats.GetTime++, AFSCallStats.TotalCalls++;
FS_UNLOCK;
- FT_GetTimeOfDay(&tpl, 0);
+ gettimeofday(&tpl, 0);
*Seconds = tpl.tv_sec;
*USeconds = tpl.tv_usec;
rx_Write(Call, (char *)&zero, sizeof(afs_int32)); /* send 0-length */
return (0);
}
- FT_GetTimeOfDay(&StartTime, 0);
+ gettimeofday(&StartTime, 0);
ihP = targetptr->handle;
fdP = IH_OPEN(ihP);
if (fdP == NULL) {
FreeSendBuffer((struct afs_buffer *)tbuffer);
#endif /* HAVE_PIOV */
FDH_CLOSE(fdP);
- FT_GetTimeOfDay(&StopTime, 0);
+ gettimeofday(&StopTime, 0);
/* Adjust all Fetch Data related stats */
FS_LOCK;
/* this bit means that the locks are set and protections are OK */
rx_SetLocalStatus(Call, 1);
- FT_GetTimeOfDay(&StartTime, 0);
+ gettimeofday(&StartTime, 0);
optSize = sendBufSize;
ViceLog(25,
}
FDH_CLOSE(fdP);
- FT_GetTimeOfDay(&StopTime, 0);
+ gettimeofday(&StopTime, 0);
VN_SET_LEN(targetptr, NewLength);
InitCallBack(int nblks)
{
H_LOCK;
- tfirst = CBtime(FT_ApproxTime());
+ tfirst = CBtime(time(NULL));
/* N.B. The "-1", below, is because
* FE[0] and CB[0] are not used--and not allocated */
FE = ((struct FileEntry *)(calloc(nblks, sizeof(struct FileEntry))));
fe = FindFE(fid);
if (type == CB_NORMAL) {
time_out =
- TimeCeiling(FT_ApproxTime() + TimeOut(fe ? fe->ncbs : 0) +
+ TimeCeiling(time(NULL) + TimeOut(fe ? fe->ncbs : 0) +
ServerBias);
Thead = THead(CBtime(time_out));
} else if (type == CB_VOLUME) {
- time_out = TimeCeiling((60 * 120 + FT_ApproxTime()) + ServerBias);
+ time_out = TimeCeiling((60 * 120 + time(NULL)) + ServerBias);
Thead = THead(CBtime(time_out));
} else if (type == CB_BULK) {
/* bulk status can get so many callbacks all at once, and most of them
* are probably not for things that will be used for long.
*/
time_out =
- TimeCeiling(FT_ApproxTime() + ServerBias +
+ TimeCeiling(time(NULL) + ServerBias +
TimeOut(22 + (fe ? fe->ncbs : 0)));
Thead = THead(CBtime(time_out));
}
int
CleanupTimedOutCallBacks_r(void)
{
- afs_uint32 now = CBtime(FT_ApproxTime());
+ afs_uint32 now = CBtime(time(NULL));
afs_uint32 *thead;
struct CallBack *cb;
int ntimedout = 0;
DumpCallBackState_r(void)
{
int fd, oflag;
- afs_uint32 magic = MAGICV2, now = (afs_int32) FT_ApproxTime(), freelisthead;
+ afs_uint32 magic = MAGICV2, now = (afs_int32) time(NULL), freelisthead;
oflag = O_WRONLY | O_CREAT | O_TRUNC;
#ifdef AFS_NT40_ENV
free(host->hcps.prlist_val); /* this is for hostaclRefresh */
host->hcps.prlist_val = NULL;
host->hcps.prlist_len = 0;
- host->cpsCall = slept ? (FT_ApproxTime()) : (now);
+ host->cpsCall = slept ? time(NULL) : (now);
H_UNLOCK;
code = hpr_GetHostCPS(ntohl(host->host), &host->hcps);
/* Make a callback channel even for the console, on the off chance that it
* makes a request that causes a break call back. It shouldn't. */
h_SetupCallbackConn_r(host);
- host->LastCall = host->cpsCall = host->ActiveCall = FT_ApproxTime();
+ host->LastCall = host->cpsCall = host->ActiveCall = time(NULL);
host->hostFlags = 0;
host->hcps.prlist_val = NULL;
host->hcps.prlist_len = 0;
goto restart;
}
h_Unlock_r(host);
- now = FT_ApproxTime(); /* always evaluate "now" */
+ now = time(NULL); /* always evaluate "now" */
if (host->hcpsfailed || (host->cpsCall + hostaclRefresh < now)) {
/*
* Every hostaclRefresh period (def 2 hrs) get the new
host = h_Alloc_r(tcon); /* returned held and locked */
if (!host)
goto gethost_out;
- h_gethostcps_r(host, FT_ApproxTime());
+ h_gethostcps_r(host, time(NULL));
if (!(host->Console & 1)) {
int pident = 0;
cb_conn = host->callback_rxcon;
AFSDIR_SERVER_CLNTDUMP_FILEPATH));
return;
}
- now = FT_ApproxTime();
+ now = time(NULL);
strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y",
localtime_r(&now, &tm));
snprintf(tmpStr, sizeof tmpStr, "List of active users at %s\n\n",
AFSDIR_SERVER_HOSTDUMP_FILEPATH));
return;
}
- now = FT_ApproxTime();
+ now = time(NULL);
strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y",
localtime_r(&now, &tm));
snprintf(tmpStr, sizeof tmpStr, "List of active hosts at %s\n\n", tbuffer);
void
h_CheckHosts(void)
{
- afs_uint32 now = FT_ApproxTime();
+ afs_uint32 now = time(NULL);
memset(&zerofid, 0, sizeof(zerofid));
/*