Telescope Control Library
Diff: EqMountServer.cpp
- Revision:
- 10:e356188d208e
- Parent:
- 4:b8ad57bbf9e1
- Child:
- 11:ec6af14e7816
--- a/EqMountServer.cpp Mon Sep 10 02:41:05 2018 -0400 +++ b/EqMountServer.cpp Fri Sep 14 01:30:55 2018 -0400 @@ -894,11 +894,18 @@ { t += (int) (remainder(server->getEqMount()->getLocation().lon, 360) * 240); - + + +#ifdef __GNUC__ + char ibuf[64]; + ctime_r(&t, ibuf); + strncpy(buf, ibuf, sizeof(buf)); +#else core_util_critical_section_enter(); char *ibuf = ctime(&t); strncpy(buf, ibuf, sizeof(buf)); core_util_critical_section_exit(); +#endif stprintf(server->getStream(), "%s %s\r\n", cmd, buf); return 0; @@ -906,11 +913,17 @@ else if (strcmp(argv[0], "zone") == 0) { t += (int) (TelescopeConfiguration::getInt("timezone") * 3600); - + +#ifdef __GNUC__ + char ibuf[64]; + ctime_r(&t, ibuf); + strncpy(buf, ibuf, sizeof(buf)); +#else core_util_critical_section_enter(); char *ibuf = ctime(&t); strncpy(buf, ibuf, sizeof(buf)); core_util_critical_section_exit(); +#endif stprintf(server->getStream(), "%s %s\r\n", cmd, buf); return 0; @@ -919,10 +932,17 @@ } // Print of formatted string of current time + +#ifdef __GNUC__ + char ibuf[64]; + ctime_r(&t, ibuf); + strncpy(buf, ibuf, sizeof(buf)); +#else core_util_critical_section_enter(); char *ibuf = ctime(&t); strncpy(buf, ibuf, sizeof(buf)); core_util_critical_section_exit(); +#endif stprintf(server->getStream(), "%s %s\r\n", cmd, buf);