GNU Units Cygwin Package
========================


Updating Currency Exchange Rates
--------------------------------

The units program includes currency exchange rates and prices for some
precious metals in the database.
Of course, these values change over time, sometimes very rapidly, and
units cannot provide real time values.

To update the exchange rates run units_cur, which rewrites the file
containing the currency rates, typically /usr/share/units/currency.units.

This program requires python and the unidecode package, and must be run
with suitable permissions to write the file.

To keep the rates updated automatically, run it using a cron job on a
Unix-like system, or a similar scheduling program on a different system.

Currency exchange rates are taken from Time Genie (http://www.timegenie.com)
and precious metals pricing from Packetizer (http://www.packetizer.com).
These sites update once per day, so there is no benefit in running the
update script more often than daily.

You can run units_cur with a filename specified on the command line and
it will write the data to that file.

If you give ‘-’ for the file it will write to standard output. 

[Extracted from GNU units manual section 17 under GFDL: the original may
be viewed by running "info units currency", and the licence may be
viewed by running "info units GNU", on this Cygwin system.]


Updating Cygwin Units Currency Exchange Rates
---------------------------------------------

Cygwin used to automatically run the currency updater script in a
permanent postinstall script run after every run of setup. 
As the currency updater script requires network access, and setup may be
run without network access, or network access available may be
expensive, slow, or unreliable, this postinstall script was removed.

For many users, currencies may never be used in units, so not running
the currency updater script will be their preferred option.

Those who use units currencies only occasionally may prefer to manually
run the currency updater script as required, or have the currency
updater script run just before they use units, if they have suitable
permissions to write the file containing the currency rates.
Those who only occasionally use units, and may use currencies, may
prefer to have the currency updater script run just before they use
units, if they have suitable permissions to write the file containing
the currency rates, or schedule the currency updater script runs
infrequently.

Those who use units and currencies regularly, or prefer their units
currency conversions up to date, or do not have suitable permissions to
write the file containing the currency rates, may prefer to schedule the
currency updater script runs daily, or have others set up scheduled runs
of the currency updater script under an account which has suitable
permissions to write the file.
Those who have suitable permissions to write the file containing the
currency rates, may prefer to run the updater script from their login
profile script.


Alternatives for Updating Cygwin Units Currency Exchange Rates
--------------------------------------------------------------

If you are setting up updates you should know how to use a text editor
to create a shell script for execution under Cygwin.

If you have suitable permissions to write the file containing the
currency rates, you may want to run the currency updater script on every
interactive login, or have it run every time you use units.


Updating Cygwin Units Currency Exchange Rates on Interactive Login
------------------------------------------------------------------

Add to your shell profile or rc file:

# update currency conversions
/usr/bin/find /var/lib/units/ -name currency.units -writable -size +0 -mtime +0 \
                                                -exec /usr/bin/units_cur \;

