receiptomatic-www: common: Switch to clock_gettime()

According to the Linux gettimeofday(2) man page this is marked as
deprecated.

    "POSIX.1-2008 marks gettimeofday() as obsolete, recommending the
     use of clock_gettime(2) instead."

So switch d_fprintf over to clock_gettime().

One difference with clock_gettime() is that it gives us nanoseconds
rather than microseconds. However microseconds is plenty accurate enough
for us, so we just divide the nanoseconds by 1000 to truncate it down to
microseonds. This is sufficient for our needs.

Signed-off-by: Andrew Clayton <andrew@opentechlabs.co.uk>
receiptomatic-www: audit: Switch to clock_gettime()

Switch log_login() from gettimeofday(2) to clock_gettime(2)

We divide the nanoseconds returned by clock_gettime() by 1000 to get the
rough microseconds value for the database (seconds.microseconds).

Signed-off-by: Andrew Clayton <andrew@opentechlabs.co.uk>
receiptomatic-www: utils: Switch to clock_gettime()

Switch generate_activation_key() from gettimeofday(2) to
clock_gettime(2).

Signed-off-by: Andrew Clayton <andrew@opentechlabs.co.uk>
receiptomatic-www: utils: Switch to clock_gettime()

Switch generate_password_hash() from gettimeofday(2) to
clock_gettime(2).

Signed-off-by: Andrew Clayton <andrew@opentechlabs.co.uk>
tools: Switch passcrypt to clock_gettime()

Signed-off-by: Andrew Clayton <andrew@opentechlabs.co.uk>
receiptomatic-www: Switch url_handlers to clock_gettime()

Switch handle_request() from gettimeofday(2) to clock_gettime(2). Also
change the request duration display from seconds to milliseconds.

Signed-off-by: Andrew Clayton <andrew@opentechlabs.co.uk>
receiptomatic-www: url_handlers: Enhance get_image()

Modify get_image() to also serve the full size images.

{full,get}_image() do mostly the same thing, the main difference being
that full_image() presents the image as a download so it can be viewed
along side the site.

Enhance get_image() so that if it is serving a full size image (medium
will not be in the path name) it sends some extra headers to tell the
browser to treat it as a download and not to view it inline.

This also has the added benifit of using the file magic to get the mime
type for the full image and then we add attachment to the
Content-Disposition header to force the browser to treat it as a
download.

Signed-off-by: Andrew Clayton <andrew@opentechlabs.co.uk>
templates: receipts: Use only /get_image/

No longer use /full_image/ for the full size images as /get_image/ can
now handle these.

Signed-off-by: Andrew Clayton <andrew@opentechlabs.co.uk>
templates: receipt_info: Use only /get_image/

No longer use /full_image/ for the full size images as /get_image/ can
now handle these.

Signed-off-by: Andrew Clayton <andrew@opentechlabs.co.uk>
templates: process_receipt: Use only /get_image/

No longer use /full_image/ for the full size images as /get_image/ can
now handle these.

Signed-off-by: Andrew Clayton <andrew@opentechlabs.co.uk>
templates: approve_receipts: Use only /get_image/

No longer use /full_image/ for the full size images as /get_image/ can
now handle these.

Signed-off-by: Andrew Clayton <andrew@opentechlabs.co.uk>
receiptomatic-www: Remove full_image() function and url handling

get_image() can now handle the serving of the full size images and
everything has been switched over to use it.

Signed-off-by: Andrew Clayton <andrew@opentechlabs.co.uk>