aboutsummaryrefslogtreecommitdiff
path: root/sem3/osc/mm1/mm2/tprog.c
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-10-12 16:26:42 +0200
committerJulian T <julian@jtle.dk>2020-10-12 16:54:48 +0200
commit4e05a55e373bd315e721d534a1711fec4c0054c5 (patch)
tree4fc0141760c2730ed79aaa4c7aa60ea45cc66cc0 /sem3/osc/mm1/mm2/tprog.c
parentb7f9cf43c8a9ab3400cbb30d5e1cadb0c6c2cf23 (diff)
Moved to linux kernel inspired clang-format
Diffstat (limited to 'sem3/osc/mm1/mm2/tprog.c')
-rw-r--r--sem3/osc/mm1/mm2/tprog.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/sem3/osc/mm1/mm2/tprog.c b/sem3/osc/mm1/mm2/tprog.c
index bb04778..82c9fb2 100644
--- a/sem3/osc/mm1/mm2/tprog.c
+++ b/sem3/osc/mm1/mm2/tprog.c
@@ -19,26 +19,26 @@ void timer_handler(int signum)
/* Calculate new alarm */
tv->tv_sec *= SPEED;
if (tv->tv_sec == 0) {
- /* If tv_usec is 0 set i to 1 sec otherwise half it */
- if (tv->tv_usec == 0) {
- tv->tv_usec = 999999;
- } else if (tv->tv_usec > ENDUSEC) {
- tv->tv_usec *= SPEED;
- if (tv->tv_usec < ENDUSEC) {
- tv->tv_usec = ENDUSEC;
- }
- } else {
- /* Return letting the timer be set to ENDUSEC */
- return;
- }
+ /* If tv_usec is 0 set i to 1 sec otherwise half it */
+ if (tv->tv_usec == 0) {
+ tv->tv_usec = 999999;
+ } else if (tv->tv_usec > ENDUSEC) {
+ tv->tv_usec *= SPEED;
+ if (tv->tv_usec < ENDUSEC) {
+ tv->tv_usec = ENDUSEC;
+ }
+ } else {
+ /* Return letting the timer be set to ENDUSEC */
+ return;
+ }
}
printf("Set to %d and %d\n", timer.it_value.tv_sec, timer.it_value.tv_usec);
/* Set alarm */
int err = setitimer(ITIMER_REAL, &timer, NULL);
if (err) {
- printf("Hey we got an error guys\n");
- exit(1);
+ printf("Hey we got an error guys\n");
+ exit(1);
}
}