changed qse_ntime_t to a structure and made related changes
This commit is contained in:
@ -648,6 +648,7 @@ public:
|
||||
|
||||
int getInt (long_t* v) const;
|
||||
int getFlt (flt_t* v) const;
|
||||
int getNum (long_t* lv, flt_t* fv) const;
|
||||
int getStr (const char_t** str, size_t* len) const;
|
||||
|
||||
int setVal (val_t* v);
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include <qse/awk/Awk.hpp>
|
||||
#include <qse/cmn/StdMmgr.hpp>
|
||||
#include <qse/cmn/time.h>
|
||||
|
||||
/// @file
|
||||
/// Standard AWK Interpreter
|
||||
@ -228,13 +229,16 @@ public:
|
||||
{
|
||||
qse_cmgr_t* cmgr;
|
||||
char_t cmgr_name[64]; // i assume that the cmgr name never exceeds this length.
|
||||
int tmout[4];
|
||||
qse_ntime_t tmout[4];
|
||||
|
||||
ioattr_t (): cmgr (QSE_NULL)
|
||||
{
|
||||
this->cmgr_name[0] = QSE_T('\0');
|
||||
for (size_t i = 0; i < QSE_COUNTOF(this->tmout); i++)
|
||||
this->tmout[i] = -999;
|
||||
{
|
||||
this->tmout[i].sec = -999;
|
||||
this->tmout[i].nsec = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -112,8 +112,8 @@ int qse_mux_delete (
|
||||
);
|
||||
|
||||
int qse_mux_poll (
|
||||
qse_mux_t* mux,
|
||||
qse_ntime_t timeout
|
||||
qse_mux_t* mux,
|
||||
const qse_ntime_t* tmout
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <qse/macros.h>
|
||||
#include <qse/cmn/tio.h>
|
||||
#include <qse/cmn/nwad.h>
|
||||
#include <qse/cmn/time.h>
|
||||
|
||||
enum qse_nwio_flag_t
|
||||
{
|
||||
@ -74,7 +75,7 @@ typedef enum qse_nwio_errnum_t qse_nwio_errnum_t;
|
||||
|
||||
struct qse_nwio_tmout_t
|
||||
{
|
||||
int r, w, c, a;
|
||||
qse_ntime_t r, w, c, a;
|
||||
};
|
||||
|
||||
typedef struct qse_nwio_tmout_t qse_nwio_tmout_t;
|
||||
|
@ -55,42 +55,44 @@
|
||||
#define QSE_NSECS_PER_USEC (1000)
|
||||
#define QSE_NSECS_PER_MSEC (QSE_NSECS_PER_USEC*QSE_USECS_PER_MSEC)
|
||||
#define QSE_USECS_PER_SEC (QSE_USECS_PER_MSEC*QSE_MSECS_PER_SEC)
|
||||
#define QSE_NSECS_PER_SEC (QSE_NSECS_PER_USEC*QSE_USECS_PER_MSEC*QSE_MSECS_PER_SEC)
|
||||
|
||||
#define QSE_IS_LEAPYEAR(year) ((!((year)%4) && ((year)%100)) || !((year)%400))
|
||||
#define QSE_DAYS_PER_YEAR(year) \
|
||||
(QSE_IS_LEAPYEAR(year)? QSE_DAYS_PER_LEAPYEAR: QSE_DAYS_PER_NORMYEAR)
|
||||
|
||||
#define QSE_SECNSEC_TO_MSEC(sec,nsec) \
|
||||
(((qse_ntime_t)(sec) * QSE_MSECS_PER_SEC) + ((qse_ntime_t)(nsec) / QSE_NSECS_PER_MSEC))
|
||||
(((qse_long_t)(sec) * QSE_MSECS_PER_SEC) + ((qse_long_t)(nsec) / QSE_NSECS_PER_MSEC))
|
||||
|
||||
#define QSE_SEC_TO_MSEC(sec) ((sec) * QSE_MSECS_PER_SEC)
|
||||
#define QSE_MSEC_TO_SEC(sec) ((sec) / QSE_MSECS_PER_SEC)
|
||||
|
||||
#define QSE_USEC_TO_NSEC(usec) ((usec) * QSE_NSECS_PER_USEC)
|
||||
#define QSE_NSEC_TO_USEC(nsec) ((nsec) / QSE_NSECS_PER_USEC)
|
||||
|
||||
#define QSE_MSEC_TO_NSEC(msec) ((msec) * QSE_NSECS_PER_MSEC)
|
||||
#define QSE_NSEC_TO_MSEC(nsec) ((nsec) / QSE_NSECS_PER_MSEC)
|
||||
|
||||
#define QSE_SEC_TO_NSEC(sec) ((sec) * QSE_NSECS_PER_SEC)
|
||||
#define QSE_NSEC_TO_SEC(nsec) ((nsec) / QSE_NSECS_PER_SEC)
|
||||
|
||||
#define QSE_SEC_TO_USEC(sec) ((sec) * QSE_USECS_PER_SEC)
|
||||
#define QSE_USEC_TO_SEC(usec) ((usec) / QSE_USECS_PER_SEC)
|
||||
|
||||
/**
|
||||
* The qse_ntime_t type defines a numeric time type expressed in the
|
||||
* number of milliseconds since the Epoch (00:00:00 UTC, Jan 1, 1970).
|
||||
*/
|
||||
typedef qse_long_t qse_ntime_t;
|
||||
|
||||
/**
|
||||
* The qse_ntprd_t type represents a time period between two time points.
|
||||
* This is period is defined to be unsigned since a time point is signed.
|
||||
*/
|
||||
typedef qse_ulong_t qse_ntprd_t;
|
||||
|
||||
/**
|
||||
* The qse_ntoff_t type represents the amount of increment or decrement
|
||||
* from a certain time point. It is defined to be type-compatible with
|
||||
* #qse_ntime_t and expresses that you're dealing with time offset or amount,
|
||||
* not an absolute time point.
|
||||
*/
|
||||
typedef qse_ntime_t qse_ntoff_t;
|
||||
typedef struct qse_ntime_t qse_ntime_t;
|
||||
struct qse_ntime_t
|
||||
{
|
||||
qse_long_t sec;
|
||||
qse_int32_t nsec; /* nanoseconds */
|
||||
};
|
||||
|
||||
typedef struct qse_btime_t qse_btime_t;
|
||||
|
||||
struct qse_btime_t
|
||||
{
|
||||
int msec; /* 0-999 */
|
||||
int sec; /* 0-61 */
|
||||
int min; /* 0-59 */
|
||||
int hour; /* 0-23 */
|
||||
@ -118,7 +120,7 @@ int qse_gettime (
|
||||
* The qse_settime() function sets the current time.
|
||||
*/
|
||||
int qse_settime (
|
||||
qse_ntime_t nt
|
||||
const qse_ntime_t* nt
|
||||
);
|
||||
|
||||
|
||||
@ -126,16 +128,16 @@ int qse_settime (
|
||||
* The qse_gmtime() function converts numeric time to broken-down time.
|
||||
*/
|
||||
int qse_gmtime (
|
||||
qse_ntime_t nt,
|
||||
qse_btime_t* bt
|
||||
const qse_ntime_t* nt,
|
||||
qse_btime_t* bt
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_localtime() converts numeric time to broken-down time
|
||||
*/
|
||||
int qse_localtime (
|
||||
qse_ntime_t nt,
|
||||
qse_btime_t* bt
|
||||
const qse_ntime_t* nt,
|
||||
qse_btime_t* bt
|
||||
);
|
||||
|
||||
/**
|
||||
@ -157,16 +159,6 @@ int qse_timelocal (
|
||||
qse_ntime_t* nt
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_strftime() functions formats time.
|
||||
*/
|
||||
qse_size_t qse_strftime (
|
||||
qse_char_t* buf,
|
||||
qse_size_t size,
|
||||
const qse_char_t* fmt,
|
||||
qse_btime_t* bt
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -248,6 +248,9 @@
|
||||
/* Define to 1 if you have MPI libs and headers. */
|
||||
#undef HAVE_MPI
|
||||
|
||||
/* Define to 1 if you have the `nanosleep' function. */
|
||||
#undef HAVE_NANOSLEEP
|
||||
|
||||
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
|
||||
#undef HAVE_NDIR_H
|
||||
|
||||
@ -293,6 +296,9 @@
|
||||
/* Define to 1 if you have the `roundl' function. */
|
||||
#undef HAVE_ROUNDL
|
||||
|
||||
/* Define to 1 if you have the `select' function. */
|
||||
#undef HAVE_SELECT
|
||||
|
||||
/* Define to 1 if you have the `sendfile' function. */
|
||||
#undef HAVE_SENDFILE
|
||||
|
||||
@ -374,6 +380,12 @@
|
||||
/* Define to 1 if `st_birthtime' is a member of `struct stat'. */
|
||||
#undef HAVE_STRUCT_STAT_ST_BIRTHTIME
|
||||
|
||||
/* Define to 1 if `st_birthtimespec.tv_nsec' is a member of `struct stat'. */
|
||||
#undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
|
||||
|
||||
/* Define to 1 if `st_birthtim.tv_nsec' is a member of `struct stat'. */
|
||||
#undef HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC
|
||||
|
||||
/* Define to 1 if `st_mtimespec.tv_nsec' is a member of `struct stat'. */
|
||||
#undef HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
|
||||
|
||||
|
@ -190,7 +190,7 @@ QSE_EXPORT int qse_parsehttptime (
|
||||
);
|
||||
|
||||
QSE_EXPORT qse_mchar_t* qse_fmthttptime (
|
||||
qse_ntime_t nt,
|
||||
const qse_ntime_t* nt,
|
||||
qse_mchar_t* buf,
|
||||
qse_size_t bufsz
|
||||
);
|
||||
|
@ -137,12 +137,12 @@ struct qse_httpd_scb_t
|
||||
void (*close) (qse_httpd_t* httpd, void* mux);
|
||||
int (*addhnd) (qse_httpd_t* httpd, void* mux, qse_ubi_t handle, int mask, void* cbarg);
|
||||
int (*delhnd) (qse_httpd_t* httpd, void* mux, qse_ubi_t handle);
|
||||
int (*poll) (qse_httpd_t* httpd, void* mux, qse_ntime_t timeout);
|
||||
int (*poll) (qse_httpd_t* httpd, void* mux, const qse_ntime_t* tmout);
|
||||
|
||||
int (*readable) (
|
||||
qse_httpd_t* httpd, qse_ubi_t handle, qse_ntoff_t timeout);
|
||||
qse_httpd_t* httpd, qse_ubi_t handle, const qse_ntime_t* tmout);
|
||||
int (*writable) (
|
||||
qse_httpd_t* httpd, qse_ubi_t handle, qse_ntoff_t timeout);
|
||||
qse_httpd_t* httpd, qse_ubi_t handle, const qse_ntime_t* tmout);
|
||||
} mux;
|
||||
|
||||
struct
|
||||
@ -580,10 +580,10 @@ QSE_EXPORT void qse_httpd_pushecb (
|
||||
* The qse_httpd_loop() function starts a httpd server loop.
|
||||
*/
|
||||
QSE_EXPORT int qse_httpd_loop (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_scb_t* scb,
|
||||
qse_httpd_rcb_t* rcb,
|
||||
qse_ntime_t timeout
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_scb_t* scb,
|
||||
qse_httpd_rcb_t* rcb,
|
||||
const qse_ntime_t* tmout
|
||||
);
|
||||
|
||||
/**
|
||||
@ -845,7 +845,7 @@ QSE_EXPORT void* qse_httpd_getserverxtnstd (
|
||||
|
||||
QSE_EXPORT int qse_httpd_loopstd (
|
||||
qse_httpd_t* httpd,
|
||||
qse_ntime_t timeout
|
||||
const qse_ntime_t* tmout
|
||||
);
|
||||
|
||||
|
||||
|
@ -80,7 +80,7 @@ struct qse_upxd_session_t
|
||||
/** binding device for peer socket */
|
||||
qse_char_t dev[QSE_UPXD_SESSION_DEV_LEN + 1];
|
||||
|
||||
#define QSE_UPXD_SESSION_DORMANCY (30000)
|
||||
#define QSE_UPXD_SESSION_DORMANCY (30)
|
||||
/** session's idle-timeout */
|
||||
qse_ntime_t dormancy;
|
||||
} config;
|
||||
|
Reference in New Issue
Block a user