Collapse the DateUtils.[ch] files into date.[ch].

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8089 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton 2003-03-17 02:02:10 +00:00
parent d417ccb041
commit f83edf6ead
13 changed files with 64 additions and 117 deletions

View File

@ -13,6 +13,18 @@
Consolidate all the functions that convert time values to be the
beginning, middle, or end of a day.
* src/backend/file/gnc-backend-file.c:
* src/backend/file/io-gncbin-r.c:
* src/engine/Makefile.am:
* src/engine/TransLog.c:
* src/engine/date.c:
* src/engine/date.h:
* src/engine/gnc-book.c:
* src/engine/gnc-session-scm.c:
* src/engine/gnc-session.c:
* src/optional/swig/Makefile.am:
Collapse the DateUtils.[ch] files into date.[ch].
2003-03-15 David Hampton <hampton@employees.org>
* src/gnome-utils/gnc-date-edit.c: Fix the keypress handlers so

View File

@ -24,7 +24,7 @@
#include "TransLog.h"
#include "gnc-engine-util.h"
#include "gnc-pricedb-p.h"
#include "DateUtils.h"
#include "date.h"
#include "io-gncxml.h"
#include "io-gncbin.h"
#include "io-gncxml-v2.h"

View File

@ -96,7 +96,6 @@
#include "AccountP.h"
#include "Backend.h"
#include "date.h"
#include "DateUtils.h"
#include "io-gncbin.h"
#include "Group.h"
#include "GroupP.h"

View File

@ -1,71 +0,0 @@
/********************************************************************\
* DateUtils.c -- Date Handling Utilities *
* Copyright (C) 1998 Linas Vepstas *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
* *
\********************************************************************/
#include "config.h"
#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "DateUtils.h"
#define BUFFSIZE 100
/* ======================================================== */
char *
xaccDateUtilGetStamp (time_t thyme)
{
struct tm *stm;
char buf[BUFFSIZE];
char * retval;
stm = localtime (&thyme);
sprintf (buf, "%04d%02d%02d%02d%02d%02d",
(stm->tm_year + 1900),
(stm->tm_mon +1),
stm->tm_mday,
stm->tm_hour,
stm->tm_min,
stm->tm_sec
);
retval = g_strdup (buf);
return retval;
}
/* ======================================================== */
char *
xaccDateUtilGetStampNow (void)
{
time_t now;
time (&now);
return xaccDateUtilGetStamp (now);
}
/************************ END OF ************************************\
\************************* FILE *************************************/

View File

@ -1,37 +0,0 @@
/********************************************************************\
* DateUtils.h -- Date Handling Utilities *
* Copyright (C) 1998 Linas Vepstas *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
* *
\********************************************************************/
#ifndef XACC_DATE_UTILS_H
#define XACC_DATE_UTILS_H
#include <time.h>
#include "config.h"
char * xaccDateUtilGetStamp (time_t thyme);
char * xaccDateUtilGetStampNow (void);
#endif /* XACC_DATE_UTILS_H */
/************************ END OF ************************************\
\************************* FILE *************************************/

View File

@ -11,7 +11,6 @@ AM_CFLAGS = \
libgncmod_engine_la_SOURCES = \
Account.c \
Backend.c \
DateUtils.c \
FreqSpec.c \
GNCId.c \
Group.c \
@ -51,7 +50,6 @@ gncincludedir = ${GNC_INCLUDE_DIR}
gncinclude_HEADERS = \
Account.h \
Backend.h \
DateUtils.h \
FreqSpec.h \
GNCId.h \
Group.h \

View File

@ -31,7 +31,6 @@
#include "Account.h"
#include "AccountP.h"
#include "DateUtils.h"
#include "date.h"
#include "Transaction.h"
#include "TransactionP.h"

View File

@ -983,6 +983,27 @@ gnc_timet_get_day_end (time_t time_val)
return mktime(&tm);
}
/* The xaccDateUtilGetStamp() routine will take the given time in
* seconds and return a buffer containing a textual for the date. */
char *
xaccDateUtilGetStamp (time_t thyme)
{
struct tm *stm;
stm = localtime (&thyme);
return g_strdup_printf("%04d%02d%02d%02d%02d%02d",
(stm->tm_year + 1900),
(stm->tm_mon +1),
stm->tm_mday,
stm->tm_hour,
stm->tm_min,
stm->tm_sec
);
}
/* ======================================================== */
void
gnc_tm_get_today_start (struct tm *tm)
{
@ -1013,5 +1034,16 @@ gnc_timet_get_today_end (void)
return mktime(&tm);
}
/* The xaccDateUtilGetStampNow() routine returns the current time in
* seconds in textual format. */
char *
xaccDateUtilGetStampNow (void)
{
time_t now;
time (&now);
return xaccDateUtilGetStamp (now);
}
/********************** END OF FILE *********************************\
\********************************************************************/

View File

@ -310,6 +310,15 @@ time_t gnc_timet_get_day_start(time_t time_val);
* seconds and adjust it to the last second of that day. */
time_t gnc_timet_get_day_end(time_t time_val);
/** The xaccDateUtilGetStamp() routine will take the given time in
* seconds and return a buffer containing a textual for the date.
* @param thyme The time in seconds to convert.
* @return A pointer to the generated string.
* @note The caller owns this buffer and must free it when done. */
char *xaccDateUtilGetStamp (time_t thyme);
/* ======================================================== */
/** The gnc_tm_get_today_start() routine takes a pointer to a struct
* tm and fills it in with the first second of the today. */
void gnc_tm_get_today_start(struct tm *tm);
@ -325,6 +334,13 @@ time_t gnc_timet_get_today_start(void);
/** The gnc_timet_get_today_end() routine returns a time_t value
* corresponding to the last second of today. */
time_t gnc_timet_get_today_end(void);
/** The xaccDateUtilGetStampNow() routine returns the current time in
* seconds in textual format.
* @return A pointer to the generated string.
* @note The caller owns this buffer and must free it when done. */
char *xaccDateUtilGetStampNow (void);
/** @} */
#endif /* XACC_DATE_H */

View File

@ -52,7 +52,7 @@
#include "engine-helpers.h"
#include "gnc-engine-util.h"
#include "gnc-pricedb-p.h"
#include "DateUtils.h"
#include "date.h"
#include "gnc-book.h"
#include "gnc-book-p.h"
#include "gnc-engine.h"

View File

@ -46,7 +46,7 @@
#include "BackendP.h"
#include "TransLog.h"
#include "gnc-engine-util.h"
#include "DateUtils.h"
#include "date.h"
#include "gnc-book-p.h"
#include "gnc-engine.h"
#include "gnc-engine-util.h"

View File

@ -46,7 +46,7 @@
#include "BackendP.h"
#include "TransLog.h"
#include "gnc-engine-util.h"
#include "DateUtils.h"
#include "date.h"
#include "gnc-book-p.h"
#include "gnc-engine.h"
#include "gnc-engine-util.h"

View File

@ -51,7 +51,6 @@ libgncswig_la_LIBADD = \
SWIG_INPUT_HDRS := \
${top_srcdir}/src/engine/Account.h \
${top_srcdir}/src/engine/DateUtils.h \
${top_srcdir}/src/engine/GNCId.h \
${top_srcdir}/src/engine/Group.h \
${top_srcdir}/src/engine/Query.h \