T.82.0: 'set bill_increment' command.
This commit is contained in:
parent
66c12e8e73
commit
d9223f4603
4 changed files with 50 additions and 21 deletions
18
configure
vendored
18
configure
vendored
|
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.69 for RT/TTS T.81.0.
|
||||
# Generated by GNU Autoconf 2.69 for RT/TTS T.82.0.
|
||||
#
|
||||
# Report bugs to <felicity@loreley.flyingparchment.org.uk>.
|
||||
#
|
||||
|
|
@ -580,8 +580,8 @@ MAKEFLAGS=
|
|||
# Identity of this package.
|
||||
PACKAGE_NAME='RT/TTS'
|
||||
PACKAGE_TARNAME='rt-tts'
|
||||
PACKAGE_VERSION='T.81.0'
|
||||
PACKAGE_STRING='RT/TTS T.81.0'
|
||||
PACKAGE_VERSION='T.82.0'
|
||||
PACKAGE_STRING='RT/TTS T.82.0'
|
||||
PACKAGE_BUGREPORT='felicity@loreley.flyingparchment.org.uk'
|
||||
PACKAGE_URL=''
|
||||
|
||||
|
|
@ -1232,7 +1232,7 @@ if test "$ac_init_help" = "long"; then
|
|||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures RT/TTS T.81.0 to adapt to many kinds of systems.
|
||||
\`configure' configures RT/TTS T.82.0 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
|
|
@ -1293,7 +1293,7 @@ fi
|
|||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of RT/TTS T.81.0:";;
|
||||
short | recursive ) echo "Configuration of RT/TTS T.82.0:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
|
|
@ -1380,7 +1380,7 @@ fi
|
|||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
RT/TTS configure T.81.0
|
||||
RT/TTS configure T.82.0
|
||||
generated by GNU Autoconf 2.69
|
||||
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
|
|
@ -1749,7 +1749,7 @@ cat >config.log <<_ACEOF
|
|||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by RT/TTS $as_me T.81.0, which was
|
||||
It was created by RT/TTS $as_me T.82.0, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
|
|
@ -4720,7 +4720,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by RT/TTS $as_me T.81.0, which was
|
||||
This file was extended by RT/TTS $as_me T.82.0, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
|
|
@ -4782,7 +4782,7 @@ _ACEOF
|
|||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||
ac_cs_version="\\
|
||||
RT/TTS config.status T.81.0
|
||||
RT/TTS config.status T.82.0
|
||||
configured by $0, generated by GNU Autoconf 2.69,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
AC_PREREQ([2.69])
|
||||
AC_INIT([RT/TTS], [T.81.0], [felicity@loreley.flyingparchment.org.uk])
|
||||
AC_INIT([RT/TTS], [T.82.0], [felicity@loreley.flyingparchment.org.uk])
|
||||
AC_CONFIG_SRCDIR([tts.c])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
|
|
|
|||
38
tts.c
38
tts.c
|
|
@ -35,6 +35,7 @@
|
|||
#include <locale.h>
|
||||
#include <stdarg.h>
|
||||
#include <inttypes.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
|
@ -176,7 +177,7 @@ static void entry_start(entry_t *);
|
|||
static void entry_stop(entry_t *);
|
||||
static void entry_free(entry_t *);
|
||||
static void entry_account(entry_t *);
|
||||
static time_t entry_time_for_day(time_t, int);
|
||||
static time_t entry_time_for_day(time_t, int, int);
|
||||
|
||||
#define time_day(t) (((t) / (60 * 60 * 24)) * (60 * 60 * 24))
|
||||
#define entry_day(e) (time_day((e)->en_created))
|
||||
|
|
@ -462,6 +463,7 @@ static int show_billable = 0;
|
|||
static int delete_advance = 1;
|
||||
static int mark_advance = 1;
|
||||
static int bill_advance = 0;
|
||||
static int bill_increment = 0;
|
||||
static char *auto_nonbillable;
|
||||
|
||||
#define VTYPE_INT 1
|
||||
|
|
@ -479,7 +481,8 @@ static variable_t variables[] = {
|
|||
{ WIDE("mark_advance"), VTYPE_BOOL, &mark_advance },
|
||||
{ WIDE("billable_advance"), VTYPE_BOOL, &bill_advance },
|
||||
{ WIDE("show_billable"), VTYPE_BOOL, &show_billable },
|
||||
{ WIDE("auto_non_billable"), VTYPE_STRING, &auto_nonbillable }
|
||||
{ WIDE("auto_non_billable"), VTYPE_STRING, &auto_nonbillable },
|
||||
{ WIDE("bill_increment"), VTYPE_INT, &bill_increment }
|
||||
};
|
||||
|
||||
static variable_t *find_variable(const WCHAR *name);
|
||||
|
|
@ -1827,9 +1830,9 @@ chtype oldbg;
|
|||
if (lastday != entry_day(en)) {
|
||||
struct tm *lt;
|
||||
WCHAR lbl[128];
|
||||
time_t itime = entry_time_for_day(entry_day(en), 1),
|
||||
ntime = entry_time_for_day(entry_day(en), 0),
|
||||
btime = entry_time_for_day(entry_day(en), 2);
|
||||
time_t itime = entry_time_for_day(entry_day(en), 1, 0),
|
||||
ntime = entry_time_for_day(entry_day(en), 0, 0),
|
||||
btime = entry_time_for_day(entry_day(en), 2, bill_increment);
|
||||
int hi, mi, si,
|
||||
hn, mn, sn,
|
||||
hb, mb, sb,
|
||||
|
|
@ -2044,29 +2047,42 @@ entry_account(en)
|
|||
/*
|
||||
* Return the amount of time for the day on which the timestamp .when falls.
|
||||
* If .inv is 0, sum non-invoiced entries; if 1, sum invoiced entries; if
|
||||
* 2, sum billable entries; if -1, sum all entries.
|
||||
* 2, sum billable entries; if -1, sum all entries. If .incr is non-zero,
|
||||
* individual entry time will be rounded up to intervals of that many minutes.
|
||||
*/
|
||||
time_t
|
||||
entry_time_for_day(when, inv)
|
||||
entry_time_for_day(when, inv, incr)
|
||||
time_t when;
|
||||
{
|
||||
time_t day = time_day(when);
|
||||
time_t sum = 0;
|
||||
entry_t *en;
|
||||
int rnd = incr * 60;
|
||||
TAILQ_FOREACH(en, &entries, en_entries) {
|
||||
time_t n;
|
||||
|
||||
if (entry_day(en) > day)
|
||||
continue;
|
||||
if (entry_day(en) < day)
|
||||
break;
|
||||
|
||||
if (inv == 0 && en->en_flags.efl_invoiced)
|
||||
continue;
|
||||
if (inv == 1 && !en->en_flags.efl_invoiced)
|
||||
continue;
|
||||
if (inv == 2 && en->en_flags.efl_nonbillable)
|
||||
continue;
|
||||
sum += en->en_secs;
|
||||
|
||||
n = en->en_secs;
|
||||
if (en->en_started)
|
||||
sum += time(NULL) - en->en_started;
|
||||
n += time(NULL) - en->en_started;
|
||||
|
||||
if (!n)
|
||||
continue;
|
||||
|
||||
if (rnd)
|
||||
n = (1 + round((n - 1) / rnd)) * rnd;
|
||||
sum += n;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
|
@ -2622,6 +2638,10 @@ int val;
|
|||
case VTYPE_STRING:
|
||||
*(char **)var->va_addr = STRDUP(argv[2]);
|
||||
break;
|
||||
|
||||
case VTYPE_INT:
|
||||
*(int *)var->va_addr = atoi(argv[2]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
13
ttsrc.sample
13
ttsrc.sample
|
|
@ -10,9 +10,8 @@
|
|||
|
||||
#set mark_advance 1
|
||||
#set delete_advance 1
|
||||
#set bill_advance 0
|
||||
|
||||
#### Miscellaneous options
|
||||
#### Billing options
|
||||
#
|
||||
# If set, show billable time in each daily summary.
|
||||
|
||||
|
|
@ -24,6 +23,16 @@
|
|||
|
||||
#set auto_non_billable [INT]
|
||||
|
||||
# If set, when calculating billing time for show_billable, each entry will be
|
||||
# rounded up to this many minutes. For example, if you bill in blocks of
|
||||
# 15 minutes:
|
||||
|
||||
#set bill_increment 15
|
||||
|
||||
# If set, automatically advance the cursor when marking an entry as billable.
|
||||
|
||||
#set bill_advance 0
|
||||
|
||||
#### Bindings
|
||||
#
|
||||
# Use the 'bind' command to (re)define keybindings. Type '?' while TTS is
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue