Question: I'm trying to create a simple doc on google docs, I have a sheet called "Income" 

With A Being name, B being a date, and C being the amount

What I need to do is get the amount for this month, date format is dd/mm/yyyy 

Any help would be appreciated!

Answer: 
Change

```
dif = (end - start) * 1000;

```

to

```
dif = (end.tv_sec - start.tv_sec) * 1000 
+ (end.tv_usec - start.tv_usec) / 1000;

```

In pseudocode:

```
Get the seconds part of the time delta
Multiply by 1000 to get milliseconds
Get the microseconds part of the time delta
Divide that part by 1000
Add that part to the milliseconds from seconds delta

```
You want:

```
dif = (end.tv_sec - start.tv_sec) + (end.tv_usec - start.tv_usec) / 1000.0;

```

Note 1: You need the tv\_sec to handle even a short duration crossing a second ticking over.

Note 2: Second term divides by a 1000.0 so as to use floating point rather than integer division.