static int get_current_time(struct current_time *cur_time) { struct timespec tp; struct tm tm; struct day_date_time *day_date_time; int ret; if (clock_gettime(CLOCK_REALTIME, &tp) == -1) { int err = -errno; error("clock_gettime: %s", strerror(-err)); return err; } day_date_time = &cur_time->exact_time_256.day_date_time; ret = encode_date_time(tp.tv_sec, &day_date_time->date_time, &day_date_time->day_of_week); if (ret) return ret; cur_time->exact_time_256.fractions256 = tp.tv_nsec * 256 / 1000000000L; cur_time->adjust_reason = adjust_reason; return 0; }
static DBusMessage *time_updated(DBusConnection *conn, DBusMessage *msg, void *data) { time_t next_dst_time = 0; uint8_t next_dst_offset; struct current_time curtime; uint8_t reason; uint8_t offset; if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_BYTE, &reason, DBUS_TYPE_BYTE, &offset, DBUS_TYPE_UINT32, &next_dst_time, DBUS_TYPE_BYTE, &next_dst_offset, DBUS_TYPE_INVALID)) { error("Invalid arguments"); return NULL; } if (reason & ~0xf) { error("Invalid adjust reason"); return btd_error_invalid_args(msg); } adjust_reason = reason; dst_offset.dst_offset = offset; encode_date_time(next_dst_time, &next_dst.date_time, NULL); next_dst.dst_offset.dst_offset = next_dst_offset; DBG("adjust_reason = %d, dst_offset = %d, " "next_dst_time = %u, next_dst_offset = %d", adjust_reason, dst_offset.dst_offset, (uint32_t)next_dst_time, next_dst_offset); if (get_current_time(&curtime) < 0) { error("Could not get current time"); return btd_error_not_available(msg); } if (reason) g_slist_foreach(time_adapters, notify_curr_time, &curtime); return dbus_message_new_method_return(msg); }
/** * Encodes the source into the destination, according to the given language. * * @param p0 the destination (Hand over as reference!) * @param p1 the destination count * @param p2 the destination size * @param p3 the source message name * @param p4 the source message name count * @param p5 the source message abstraction * @param p6 the source message abstraction count * @param p7 the source message model * @param p8 the source message model count * @param p9 the source message details * @param p10 the source message details count * @param p11 the source metadata name * @param p12 the source metadata name count * @param p13 the source metadata abstraction * @param p14 the source metadata abstraction count * @param p15 the source metadata model * @param p16 the source metadata model count * @param p17 the source metadata details * @param p18 the source metadata details count * @param p19 the knowledge memory * @param p20 the knowledge memory count * @param p21 the language * @param p22 the language count */ void encode(void* p0, void* p1, void* p2, void* p3, void* p4, void* p5, void* p6, void* p7, void* p8, void* p9, void* p10, void* p11, void* p12, void* p13, void* p14, void* p15, void* p16, void* p17, void* p18, void* p19, void* p20, void* p21, void* p22) { log_terminated_message((void*) INFORMATION_LEVEL_LOG_MODEL, (void*) L"Encode."); // The comparison result. int r = *NUMBER_0_INTEGER_MEMORY_MODEL; if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) BOOLEAN_LOGICVALUE_CYBOL_ABSTRACTION, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) BOOLEAN_LOGICVALUE_CYBOL_ABSTRACTION_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { encode_boolean(p0, p1, p2, p7, p8); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) CARTESIAN_COMPLEX_NUMBER_CYBOL_ABSTRACTION, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) CARTESIAN_COMPLEX_NUMBER_CYBOL_ABSTRACTION_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { encode_complex(p0, p1, p2, p7, p8); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) CYBOL_TEXT_CYBOL_ABSTRACTION, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) CYBOL_TEXT_CYBOL_ABSTRACTION_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { encode_cybol(p0, p1, p2, p7, p8); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) DECIMAL_FRACTION_NUMBER_CYBOL_ABSTRACTION, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) DECIMAL_FRACTION_NUMBER_CYBOL_ABSTRACTION_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { encode_double_vector(p0, p1, p2, p7, p8); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) ENCAPSULATED_KNOWLEDGE_PATH_CYBOL_ABSTRACTION, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) ENCAPSULATED_KNOWLEDGE_PATH_CYBOL_ABSTRACTION_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { overwrite_array(p0, p7, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p8, p1, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, p1, p2); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) GNU_LINUX_CONSOLE_CYBOL_CHANNEL, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) GNU_LINUX_CONSOLE_CYBOL_CHANNEL_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { //?? encode_gnu_linux_console(p0, p1, p2, p7, p8, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, p13, p14); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) HH_MM_SS_DATETIME_CYBOL_ABSTRACTION, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) HH_MM_SS_DATETIME_CYBOL_ABSTRACTION_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { encode_date_time(p0, p1, p2, p7, p8); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) HTML_TEXT_CYBOL_ABSTRACTION, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) HTML_TEXT_CYBOL_ABSTRACTION_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { encode_html(p0, p1, p2, p5, p6, p7, p8, p9, p10, p19, p20); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) HTTP_REQUEST_MESSAGE_CYBOL_ABSTRACTION, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) HTTP_REQUEST_MESSAGE_CYBOL_ABSTRACTION_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { //?? encode_http_request(); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) HTTP_RESPONSE_MESSAGE_CYBOL_ABSTRACTION, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) HTTP_RESPONSE_MESSAGE_CYBOL_ABSTRACTION_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { encode_http_response(p0, p1, p2, p5, p6, p7, p8, p9, p10, p13, p14, p15, p16, p17, p18); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) INTEGER_MEMORY_ABSTRACTION, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) INTEGER_MEMORY_ABSTRACTION_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { encode_integer_vector(p0, p1, p2, p7, p8); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) KNOWLEDGE_PATH_CYBOL_ABSTRACTION, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) KNOWLEDGE_PATH_CYBOL_ABSTRACTION_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { overwrite_array(p0, p7, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p8, p1, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, p1, p2); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) LATEX_APPLICATION_X_CYBOL_ABSTRACTION, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) LATEX_APPLICATION_X_CYBOL_ABSTRACTION_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { encode_latex(p0, p1, p2, p7, p8); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) MODEL_DIAGRAM_TEXT_CYBOL_ABSTRACTION, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) MODEL_DIAGRAM_TEXT_CYBOL_ABSTRACTION_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { encode_model_diagram(p0, p1, p2, p3); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) PLAIN_OPERATION_CYBOL_ABSTRACTION, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) PLAIN_OPERATION_CYBOL_ABSTRACTION_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { overwrite_array(p0, p7, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p8, p1, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, p1, p2); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) PLAIN_TEXT_CYBOL_ABSTRACTION, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) PLAIN_TEXT_CYBOL_ABSTRACTION_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { overwrite_array(p0, p7, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p8, p1, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, p1, p2); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) TERMINAL_BACKGROUND_COLOUR_CYBOL_ABSTRACTION, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) TERMINAL_BACKGROUND_COLOUR_CYBOL_ABSTRACTION_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { encode_terminal_background(p0, p1, p2, p7, p8); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) TERMINAL_FOREGROUND_COLOUR_CYBOL_ABSTRACTION, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) TERMINAL_FOREGROUND_COLOUR_CYBOL_ABSTRACTION_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { encode_terminal_foreground(p0, p1, p2, p7, p8); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) VULGAR_FRACTION_NUMBER_CYBOL_ABSTRACTION, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) VULGAR_FRACTION_NUMBER_CYBOL_ABSTRACTION_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { encode_fraction(p0, p1, p2, p7, p8); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) X_WINDOW_SYSTEM_CYBOL_CHANNEL, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) X_WINDOW_SYSTEM_CYBOL_CHANNEL_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { encode_x_window_system(p0, p1, p2, p7, p8, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, p19, p20); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) XDT_TEXT_CYBOL_ABSTRACTION, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) XDT_TEXT_CYBOL_ABSTRACTION_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { encode_xdt(p0, p1, p2, p7, p8); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_all_array((void*) &r, p21, (void*) YYYY_MM_DD_DATETIME_CYBOL_ABSTRACTION, (void*) EQUAL_PRIMITIVE_OPERATION_ABSTRACTION, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, p22, (void*) YYYY_MM_DD_DATETIME_CYBOL_ABSTRACTION_COUNT); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { encode_ddmmyyyy_date_time(p0, p1, p2, p7, p8); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { log_terminated_message((void*) WARNING_LEVEL_LOG_MODEL, (void*) L"Could not encode. The language is unknown."); } }