first commit; got the readme and main source file

This commit is contained in:
randomuser 2020-10-24 03:13:48 +00:00
commit a1ecf7e2b8
2 changed files with 154 additions and 0 deletions

111
README Normal file
View File

@ -0,0 +1,111 @@
practice
========
keep track of instrument practicing minutes
+-----+
|USAGE|
+-----+
=> record a practice session
$ practice
wait until the end of your practice session, then control-c
=> read out practice sessions in the current period (for a
report)
$ practice report
=> read out a practice sessions for a given period (for a
report)
$ practice report 2
=> start new reporting period
$ practice period
+------+
|CONFIG|
+------+
=> save location
#define SAVLOCO "/home/user/savelocation"
=> name
$ practice name <name>
=> instrument
$ practice instrument <instrument>
+----------------+
|SAVE FILE FORMAT|
+----------------+
HEADER
+-+-----------------------------+
|1| <name> |
|2| <instrument name> |
+-+-----------------------------+
The following lines can be in any order. It is left to the
reader to determine what behavior they implement.
PRACTICE SESSION
+----------------------+
|P0210201923 Music in F|
+----------------------+
- the first character of a practice session entry is always
ASCII P
- the next two characters is the month, from 01-12
- the next two characters is the day, from 01-31
- the next four characters is the year, from 0000-9999
- the next characters until the delimiting space are
considered the length of the practice session in
minutes, from 1-255
- the next character, the delimiting space, delimits the
metadata on the left and the name of the piece on the right
- the remaining characters are considered the name of the
piece you are practicing
PERIOD
+-----------------+
|S02 First Quarter|
+-----------------+
- the first character of a period entry is always ASCII S
- the next two characters is the ID, ranging from 00-99
- the next character is the space delimiter
- the following characters is the human readable period name
END
+---+
|END|
+---+
- an end line is valid only if:
+ the first character in the line should ALWAYS be ASCII E,
followed by ASCII N, and ASCII D.
+ the line is located at the last line of the file
AN EXAMPLE
+--+--------------------------------------------------------+
|01|randomington userington |
|02|F Horn |
|03|S00 First Quarter |
|04|P0908202024 Generic Practice |
|05| ... more entries ... |
|06|S01 Second Quarter |
|07| ... more entries ... |
|08|END |
+--+--------------------------------------------------------+
+----+
|BUGS|
+----+
=> practice sessions fail due to starting in one day and
ending in another [will not fix]
+ practicing in the middle of the night is never a good
idea
This document, and all related articles shall be published
under public domain. The author, randomuser,
(randomuser@tilde.club) hereby discharges all warranty
under applicable law, if legal.

43
main.c Normal file
View File

@ -0,0 +1,43 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <signal.h>
time_t buf;
struct tm bt;
struct tm et;
int flg = 1;
struct time {
int hour;
int min;
};
struct date {
int year;
int month;
int day;
};
void sighnd() { flg = 0; }
void flgwt() { while(flg) { continue; } }
int writeData(int fd, struct time time, int minutes);
struct time timediff(struct tm f, struct tm l) {
struct time tmp;
tmp.hour = f.tm_hour - l.tm_hour;
tmp.min = f.tm_min - l.tm_min;
return tmp;
}
int main(int argc, char **argv) {
if(argc == 1) {
buf = time(NULL);
bt = *localtime(&buf);
}
printf("%d:%02d:%02d\n", bt.tm_hour, bt.tm_min, bt.tm_year + 1900);
signal(SIGINT, sighnd);
flgwt();
printf("exiting lol\n";
return 0;
}