I planned to ask a code golf involving GPS:

What's the current zodiac?

Objective: Display the emoji of the zodiac of current time, according to your location.

1. There's no input.
2. If your system cannot access GPS, use your system locale and your system time.
(blah blah blah)

But I doubt whether golfing languages can access GPS.

So, can golfing languages use GPS, or at least system locale and system time?

  • 5
    \$\begingroup\$ It's not like you have to accommodate golflangs, but do consider how much this actually gains from relying on GPS versus, say, taking input. I'm not really sure how practical languages would access it, actually... \$\endgroup\$ Oct 3 '19 at 1:21
  • \$\begingroup\$ @UnrelatedString Then what about system locale and system time? \$\endgroup\$ Oct 3 '19 at 1:24
  • 2
    \$\begingroup\$ Not an answer, but: thanks for asking on meta. Please also use the meta sandbox when you've finished drafting the question. \$\endgroup\$ Oct 3 '19 at 10:41
  • \$\begingroup\$ @PeterTaylor I posted it on sandbox. Go check it. \$\endgroup\$ Oct 5 '19 at 0:50

Going one step behind language support, what is this concept of system locale? I've run code on systems which don't even have the concept of system time.

That aside, how should people test their code if it relies on system properties?

It is almost always preferable to supply times, timezones, etc. as inputs via stdin / arguments / other standard mechanisms. (My memory is that it used to say this explicitly in the tag wiki for , before that tag was synonimised).

  • \$\begingroup\$ I used to code in C++. (It's Haskell now, btw) In C++, you can get the system locale via std::locale. As of C++20, it's even possible to access a GPS via std::chrono::gps_clock. Isn't that doable in other languages? \$\endgroup\$ Oct 3 '19 at 12:38
  • 2
    \$\begingroup\$ That's a C/C++ concept. A few other languages which try to copy C APIs might have it, but even environments like .Net and the JVM have extremely different ideas of what a locale is. I think it's fair to say that Windows and OS X have some concept of a system locale, but I'm not convinced that Linux does. And as for Arduino and other lightweight systems... \$\endgroup\$ Oct 3 '19 at 13:04
  • \$\begingroup\$ I'd argue that there are essentially two ways to take this challenge. Either you pass in data via input, or you require the program to take GPS data (and only GPS data). These are two very different challenges: One is about interfacing with the hardware, the other is about processing the GPS data. \$\endgroup\$ Oct 3 '19 at 19:31
  • \$\begingroup\$ @Nathan, it's unclear to me why either of them is about interfacing with hardware. \$\endgroup\$ Oct 3 '19 at 21:16
  • \$\begingroup\$ by "take GPS data" I mean "take GPS data from the hardware". Whether that be through a library, or directly calling the hardware, I don't care; that would be the challenge though. \$\endgroup\$ Oct 3 '19 at 23:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .