diff options
author | John Wiegley <johnw@newartisans.com> | 2004-06-21 05:37:40 -0400 |
---|---|---|
committer | johnw <johnw@newartisans.com> | 2004-06-21 05:37:40 -0400 |
commit | f077b655d01364275c1f8944aee0a0ed2d530245 (patch) | |
tree | aff89cb52a6c41e135afb5cf6584ec255f05d5d5 /ledger.cc | |
parent | c892e8c7ad0aaf6c47ff6e9075149a76188ae670 (diff) | |
download | fork-ledger-f077b655d01364275c1f8944aee0a0ed2d530245.tar.gz fork-ledger-f077b655d01364275c1f8944aee0a0ed2d530245.tar.bz2 fork-ledger-f077b655d01364275c1f8944aee0a0ed2d530245.zip |
pricing fixes, added price command
Diffstat (limited to 'ledger.cc')
-rw-r--r-- | ledger.cc | 16 |
1 files changed, 3 insertions, 13 deletions
@@ -29,9 +29,10 @@ void commodity::set_price(amount * price, std::time_t * when) conversion = price; } -amount * commodity::price(std::time_t * when, bool download) const +amount * commodity::price(std::time_t * when, + bool use_history, bool download) const { - if (conversion || ! when) + if (conversion || ! when || ! use_history) return conversion; std::time_t age; @@ -61,17 +62,6 @@ amount * commodity::price(std::time_t * when, bool download) const char buf[256]; buf[0] = '\0'; - cout << "Consulting the Internet for " << symbol << endl; - strftime(buf, 127, "%Y/%m/%d %H:%M:%S", localtime(when)); - cout << " when: " << buf << endl; - if (price) { - strftime(buf, 127, "%Y/%m/%d %H:%M:%S", localtime(&age)); - cout << " age: " << buf << endl; - cout << " diff (when, age): " << difftime(*when, age) << endl; - } else { - cout << " diff (now, when): " << difftime(now, *when) << endl; - } - if (FILE * fp = popen((string("getquote ") + symbol).c_str(), "r")) { if (feof(fp) || ! fgets(buf, 255, fp)) { fclose(fp); |