aboutsummaryrefslogtreecommitdiff
path: root/semestr-4/sieci/pracownia3/franciszek_malinka/utils.h
blob: eccf34713b81309e7b3385afcee48e3d13ed759b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#ifndef UTILS_H
#define UTILS_H

#include <stddef.h>
#include <time.h>

#define NS_TO_MS(X) ((long)(X) / (long)1000000)
#define S_TO_MS(X) ((long)(X) * (long)1000)

size_t min(size_t x, size_t y);

int get_socket();

long get_time_interval(struct timespec start, struct timespec finish);

int poll_socket_modify_timeout(int sockfd, int *timeout);

#endif