So, i woke this morning, and I was checking how many my pokemon survived, well all of them did, but my Lanturn caught my attention, because I now have a second gold gym badge, so defending a gym for 20 days 12 hours is a gold gym badge, and the thing that helped me? The gym is the most rural thing in the world, and it is somewhat hard to access. Here is a pic of it:
So as you can see, I have around 21 days of defending the gym, so it is quite obvious that getting a gold gym badge is simple, just defend a gym for 3 weeks total. I hope my mini-guide helped you!