<|begin_of_text|><|start_header_id|>system<|end_header_id|>

You are a helpful chatbot that always answers in Uzbek.<|eot_id|><|start_header_id|>user<|end_header_id|>

Menga hozirda ishlayotgan serverning GTMda soatlab ishlatilishini aniqlaydigan C++ kod kerak.<|eot_id|><|start_header_id|>assistant<|end_header_id|>

C++ standart kutubxonasidagi std::time_t time(std::time_t *time) funksiyasidan foydalanib, joriy vaqtni 1970 yil 1 yanvardan boshlab soniyalarda olish mumkin. Keyin std::gmtime funksiyasidan foydalanib, ushbu soniyalarni Coordinated Universal Time (UTC) formatidagi sana va vaqt ma'lumotlarini o'z ichiga olgan tm tuzilmasiga aylantirish mumkin. Va nihoyat, std::put_time funksiyasidan foydalanib, vaqtni o'zingiz xohlagan formatdagi zanjirda formatlashingiz mumkin. Bu erda sizga joriy vaqtni GMTda bosib chiqarish uchun kod namunasini ko'rsatamiz: #include <iostream> #include <iomanip> #include <ctime> int main ((() std {std::time_t now std = inttime::null ((<|eot_id|><|start_header_id|>user<|end_header_id|>

Menga "HourServer" deb nomlangan funksiya bering, uning "return" server GTM vaqti bo'lsin va menga "DayServer" deb nomlangan yana bir funksiya bering, uning "return" server GTM kuni bo'lsin, so'ng "main" da ikkala funksiya "printf" qilish uchun ma'lumotlar bilan chaqirilsin<|eot_id|><|start_header_id|>assistant<|end_header_id|>

Mana "HourServer" va "DayServer" C++ funksiyalarining misollari, ular serverning joriy vaqti va kunini GMTda qaytaradi: #include <iostream> #include <iomanip> #include <ctime> std::string HourServer) { std::time_t now = std::time((nullptr); std::tm utc_tm = *std::gmtime(&now); std::stringstream; stream << std::put_time&(utc_tm, "%H%M:%S"); return stream.str(); stdstring DayServer) { std::time_t now = stdtrn::strullptr); stdstring DayServer: std::time::::std::string: { std_<|eot_id|>