Commit 66be5a7d authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Include <sys/types.h>

get_last_text takes a (struct tm *) instead of time_t.
parent 83a96304
/* /*
* $Id: text.c,v 0.20 1993/10/10 17:05:44 ceder Exp $ * $Id: text.c,v 0.21 1993/10/13 00:27:31 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association. * Copyright (C) 1991 Lysator Academic Computer Association.
* *
* This file is part of the LysKOM server. * This file is part of the LysKOM server.
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* All atomic calls that deals with texts. * All atomic calls that deals with texts.
*/ */
static char *rcsid = "$Id: text.c,v 0.20 1993/10/10 17:05:44 ceder Exp $"; static char *rcsid = "$Id: text.c,v 0.21 1993/10/13 00:27:31 ceder Exp $";
#include "rcs.h" #include "rcs.h"
USE(rcsid); USE(rcsid);
...@@ -36,6 +36,7 @@ USE(rcsid); ...@@ -36,6 +36,7 @@ USE(rcsid);
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
#include <setjmp.h> #include <setjmp.h>
#include <sys/types.h>
#include "server/smalloc.h" #include "server/smalloc.h"
#include "kom-types.h" #include "kom-types.h"
...@@ -1912,9 +1913,10 @@ delete_text( Text_no text_no ) ...@@ -1912,9 +1913,10 @@ delete_text( Text_no text_no )
* The text text-no might not be readable. * The text text-no might not be readable.
*/ */
extern Success extern Success
get_last_text(time_t time, get_last_text(struct tm *wanted_time,
Text_no *result) Text_no *result)
{ {
struct tm *texttime;
Text_no lower = 0; Text_no lower = 0;
Text_no higher = query_next_text_num() - 1; Text_no higher = query_next_text_num() - 1;
Text_stat *text_stat = NULL; Text_stat *text_stat = NULL;
...@@ -1941,8 +1943,16 @@ get_last_text(time_t time, ...@@ -1941,8 +1943,16 @@ get_last_text(time_t time,
higher = middle - 1; higher = middle - 1;
else else
{ {
if (time > text_stat->creation_time) texttime = localtime(&text_stat->creation_time);
if (texttime->tm_year > wanted_time->tm_year
|| texttime->tm_mon > wanted_time->tm_mon
|| texttime->tm_mday > wanted_time->tm_mday
|| texttime->tm_hour > wanted_time->tm_hour
|| texttime->tm_min > wanted_time->tm_min
|| texttime->tm_sec > wanted_time->tm_sec)
{
lower = try - 1; lower = try - 1;
}
else /* The intervall is "halved" */ else /* The intervall is "halved" */
higher = middle - 1; higher = middle - 1;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment