added timezone offset to output

This commit is contained in:
Steffen Vogel 2013-05-05 01:26:18 +02:00
parent 4006850325
commit 8e1a807120

View file

@ -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);