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

```
For quick benchmark, I'd use `clock()` and `CLOCKS_PER_SEC`.

Here's some macro code I use:

```
#define CLOCK_TICK(acc, ctr)  ctr = std::clock()
#define CLOCK_TOCK(acc, ctr)  acc += (std::clock() - ctr)
#define CLOCK_RESET(acc) acc = 0
#define CLOCK_REPORT(acc) (1000. * double(acc) / double(CLOCKS_PER_SEC))

static clock_t t1a, t1c;

int main()
{
   while (true)
   {
     CLOCK_RESET(t1a);
     init_stuff();
     CLOCK_TICK(t1a, t1c);
     critical_function();
     CLOCK_TOCK(t1a, t1c);

     std::cout << "This round took " << CLOCK_REPORT(t1a) << "ms.\n";
   }
}

```

You can get a higher-resolution clock out of the new `<chrono>` header. The macros should be straight-forward to adapt.