From 8e1a80712092f78abe200e3f5e6515904049c9cb Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 5 May 2013 01:26:18 +0200 Subject: [PATCH] added timezone offset to output --- src/formatter.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/formatter.c b/src/formatter.c index cf713e9..c035fd9 100644 --- a/src/formatter.c +++ b/src/formatter.c @@ -41,8 +41,11 @@ void format_result(const char *format, struct object_details *result) { /* convert results */ ln_deg_to_hms(result->equ.ra, &ra); ln_get_hrz_from_equ(&result->equ, &result->obs, result->jd, &result->hrz); + result->azidir = ln_hrz_to_nswe(&result->hrz); + result->hrz.az = ln_range_degrees(result->hrz.az + 180); + result->hrz.alt = ln_range_degrees(result->hrz.alt); struct specifiers specifiers[] = { {"%J", &result->jd, DOUBLE}, @@ -64,15 +67,15 @@ void format_result(const char *format, struct object_details *result) { if (strstr(local_format, specifiers[i].token) != NULL) { switch (specifiers[i].format) { case DOUBLE: snprintf(buffer, sizeof(buffer), "%." PRECISION "f", * (double *) specifiers[i].data); break; - case STRING: snprintf(buffer, sizeof(buffer), "%s", (char *) specifiers[i].data); break; - case INTEGER: snprintf(buffer, sizeof(buffer), "%d", * (int *) specifiers[i].data); break; + case STRING: snprintf(buffer, sizeof(buffer), "%s", (char *) specifiers[i].data); break; + case INTEGER: snprintf(buffer, sizeof(buffer), "%d", * (int *) specifiers[i].data); break; } local_format = strreplace(local_format, specifiers[i].token, buffer); } } - strfjd(buffer, sizeof(buffer), local_format, result->jd); + strfjd(buffer, sizeof(buffer), local_format, result->jd, result->tz); printf("%s\n", buffer); free(local_format);