~ubuntu-branches/debian/sid/conky/sid

« back to all changes in this revision

Viewing changes to src/temphelper.c

  • Committer: Bazaar Package Importer
  • Author(s): Cesare Tirabassi
  • Date: 2010-03-28 21:19:51 UTC
  • mfrom: (1.3.1 upstream) (16.1.17 lucid)
  • Revision ID: james.westby@ubuntu.com-20100328211951-ejq536k2r858srli
Tags: 1.8.0-1
* New upstream release:
  - add AF_UNIX socket support
  - fix sigsegv if config file is deleted (LP: #525926)
  - the following debian bugs are closed by this upload:
    + change automake1.10 to automake1.11 (Closes: #550929)
    + hwmon made compatible with kernels >= 2.6.31 (Closes: #556926)
    + text_buffer_size change is well documented (Closes: #519401)
    + fix diskio for not existing devices (Closes: #536557)
    + fix wrong mixer values on some systems (Closes: #540282)
    + fix minor memory leak (Closes: #566524)
    + fix some documentation error re. graphs (Closes: #564518)
    + add -p/--pause startup option (Closes: #513440)
    + fix documentation about mixer values (Closes: #538760)
* This release is based on the Ubuntu package with the following changes
  necessary for Debian (Closes: #536320):
  - change control and rules to build correctly on non-Linux arches
    (Closes: #536326)
  - updated NEWS, descriptions in control and changelog
  - change archive area to contrib
* Change priority of metapackage to extra
* My utmost thanks go to Kapil Hari Paranjape for his packaging work and to
  Luca Falavigna for being so kind to review and sponsor this release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* temphelper.c:  aid in converting temperature units
 
1
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
 
2
 * vim: ts=4 sw=4 noet ai cindent syntax=c
 
3
 *
 
4
 * temphelper.c:  aid in converting temperature units
2
5
 *
3
6
 * Copyright (C) 2008 Phil Sutter <Phil@nwl.cc>
4
7
 *
30
33
/* default to output in celsius */
31
34
static enum TEMP_UNIT output_unit = TEMP_CELSIUS;
32
35
 
33
 
static double
34
 
fahrenheit_to_celsius(double n)
 
36
static double fahrenheit_to_celsius(double n)
35
37
{
36
38
        return ((n - 32) * 5 / 9);
37
39
}
38
40
 
39
 
static double
40
 
celsius_to_fahrenheit(double n)
 
41
static double celsius_to_fahrenheit(double n)
41
42
{
42
43
        return ((n * 9 / 5) + 32);
43
44
}
44
45
 
45
 
int
46
 
set_temp_output_unit(const char *name)
 
46
int set_temp_output_unit(const char *name)
47
47
{
48
 
        size_t i;
 
48
        long i;
49
49
        int rc = 0;
50
50
        char *buf;
51
51
 
53
53
                return 1;
54
54
 
55
55
        buf = strdup(name);
56
 
        for (i = 0; i < strlen(name); i++)
 
56
        for (i = 0; i < (long)strlen(name); i++)
57
57
                buf[i] = tolower(name[i]);
58
58
 
59
59
        if (!strcmp(buf, "celsius"))
66
66
        return rc;
67
67
}
68
68
 
69
 
static double
70
 
convert_temp_output(double n, enum TEMP_UNIT input_unit)
 
69
static double convert_temp_output(double n, enum TEMP_UNIT input_unit)
71
70
{
72
71
        if (input_unit == output_unit)
73
72
                return n;